Commit 1f56c38a authored by hadret's avatar hadret

feat: introduce brotli support (extras & full).

feat: http-upsync: Upgrade to 2.1.1
feat: http-geoip2: Upgrade to 3.3
parent e501f630
nginx (1.16.1-2bionic0) bionic; urgency=medium
* Non-maintainer upload.
* feat: introduce brotli support (in extras & full).
* feat: http-upsync: Upgrade to 2.1.1.
* feat: http-geoip2: Upgrade to 3.3.
-- Filip Chabik <hadret@gmail.com> Sat, 09 Nov 2019 15:17:45 +0000
nginx (1.16.1-1bionic0) bionic; urgency=medium
* Non-maintainer upload.
......
......@@ -7,6 +7,7 @@ Uploaders: Christos Trochalakis <ctrochalakis@debian.org>
Build-Depends: debhelper (>= 10),
po-debconf,
dpkg-dev (>= 1.15.5),
libbrotli-dev,
libexpat-dev,
libgd-dev,
libgeoip-dev,
......
# Contributing
Want to contribute? Great! First, read this page (including the small print at the end).
### Before you contribute
Before we can use your code, you must sign the
[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual)
(CLA), which you can do online. The CLA is necessary mainly because you own the
copyright to your changes, even after your contribution becomes part of our
codebase, so we need your permission to use and distribute your code. We also
need to be sure of various other things—for instance that you'll tell us if you
know that your code infringes on other people's patents. You don't have to sign
the CLA until after you've submitted your code for review and a member has
approved it, but you must do it before we can put your code into our codebase.
Before you start working on a larger contribution, you should get in touch with
us first through the issue tracker with your idea so that we can help out and
possibly guide you. Coordinating up front makes it much easier to avoid
frustration later on.
### Code reviews
All submissions, including submissions by project members, require review. We
use Github pull requests for this purpose.
### The small print
Contributions made by corporations are covered by a different agreement than
the one above, the
[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).
/*
* Copyright (C) 2002-2015 Igor Sysoev
* Copyright (C) 2011-2015 Nginx, Inc.
* Copyright (C) 2015-2019 Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
# ngx_brotli
Brotli is a generic-purpose lossless compression algorithm that compresses data
using a combination of a modern variant of the LZ77 algorithm, Huffman coding
and 2nd order context modeling, with a compression ratio comparable to the best
currently available general-purpose compression methods. It is similar in speed
with deflate but offers more dense compression.
ngx_brotli is a set of two nginx modules:
- ngx_brotli filter module - used to compress responses on-the-fly,
- ngx_brotli static module - used to serve pre-compressed files.
[![TravisCI Build Status](https://travis-ci.org/google/ngx_brotli.svg?branch=master)](https://travis-ci.org/google/ngx_brotli)
## Table of Contents
- [Status](#status)
- [Installation](#installation)
- [Configuration directives](#configuration-directives)
- [`brotli_static`](#brotli_static)
- [`brotli`](#brotli)
- [`brotli_types`](#brotli_types)
- [`brotli_buffers`](#brotli_buffers)
- [`brotli_comp_level`](#brotli_comp_level)
- [`brotli_window`](#brotli_window)
- [`brotli_min_length`](#brotli_min_length)
- [Variables](#variables)
- [`$brotli_ratio`](#brotli_ratio)
- [Contributing](#contributing)
- [License](#license)
## Status
Both Brotli library and nginx module are under active development.
## Installation
$ cd nginx-1.x.x
$ ./configure --add-module=/path/to/ngx_brotli
$ make && make install
## Configuration directives
### `brotli_static`
- **syntax**: `brotli_static on|off|always`
- **default**: `off`
- **context**: `http`, `server`, `location`
Enables or disables checking of the existence of pre-compressed files with`.br`
extension. With the `always` value, pre-compressed file is used in all cases,
without checking if the client supports it.
### `brotli`
- **syntax**: `brotli on|off`
- **default**: `off`
- **context**: `http`, `server`, `location`, `if`
Enables or disables on-the-fly compression of responses.
### `brotli_types`
- **syntax**: `brotli_types <mime_type> [..]`
- **default**: `text/html`
- **context**: `http`, `server`, `location`
Enables on-the-fly compression of responses for the specified MIME types
in addition to `text/html`. The special value `*` matches any MIME type.
Responses with the `text/html` MIME type are always compressed.
### `brotli_buffers`
- **syntax**: `brotli_buffers <number> <size>`
- **default**: `32 4k|16 8k`
- **context**: `http`, `server`, `location`
**Deprecated**, ignored.
### `brotli_comp_level`
- **syntax**: `brotli_comp_level <level>`
- **default**: `6`
- **context**: `http`, `server`, `location`
Sets on-the-fly compression Brotli quality (compression) `level`.
Acceptable values are in the range from `0` to `11`.
### `brotli_window`
- **syntax**: `brotli_window <size>`
- **default**: `512k`
- **context**: `http`, `server`, `location`
Sets Brotli window `size`. Acceptable values are `1k`, `2k`, `4k`, `8k`, `16k`,
`32k`, `64k`, `128k`, `256k`, `512k`, `1m`, `2m`, `4m`, `8m` and `16m`.
### `brotli_min_length`
- **syntax**: `brotli_min_length <length>`
- **default**: `20`
- **context**: `http`, `server`, `location`
Sets the minimum `length` of a response that will be compressed.
The length is determined only from the `Content-Length` response header field.
## Variables
### `$brotli_ratio`
Achieved compression ratio, computed as the ratio between the original
and compressed response sizes.
## Contributing
See [Contributing](CONTRIBUTING.md).
## License
Copyright (C) 2002-2015 Igor Sysoev
Copyright (C) 2011-2015 Nginx, Inc.
Copyright (C) 2015 Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
# Copyright (C) 2019 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# Make sure the module knows it is a submodule.
ngx_addon_name=ngx_brotli
. $ngx_addon_dir/filter/config
# Make sure the module knows it is a submodule.
ngx_addon_name=ngx_brotli
. $ngx_addon_dir/static/config
# The final name for reporting.
ngx_addon_name=ngx_brotli
# Copyright (C) 2015-2016 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
if [ "$ngx_addon_name" = "ngx_brotli" ]; then
BROTLI_MODULE_SRC_DIR="$ngx_addon_dir/filter"
else
BROTLI_MODULE_SRC_DIR="$ngx_addon_dir"
fi
ngx_addon_name=ngx_brotli_filter
if [ -z "$ngx_module_link" ]; then
cat << END
$0: error: Brotli module requires recent version of NGINX (1.9.11+).
END
exit 1
fi
ngx_module_type=HTTP_FILTER
ngx_module_name=ngx_http_brotli_filter_module
brotli="$ngx_addon_dir/deps/brotli/c"
if [ ! -f "$brotli/include/brotli/encode.h" ]; then
brotli="/usr/local"
fi
if [ ! -f "$brotli/include/brotli/encode.h" ]; then
brotli="/usr"
fi
if [ ! -f "$brotli/include/brotli/encode.h" ]; then
cat << END
$0: error: \
Brotli library is missing from the $brotli directory.
Please make sure that the git submodule has been checked out:
cd $ngx_addon_dir && git submodule update --init && cd $PWD
END
exit 1
fi
BROTLI_LISTS_FILE="$brotli/../scripts/sources.lst"
if [ -f "$BROTLI_LISTS_FILE" ]; then
BROTLI_LISTS=`cat "$BROTLI_LISTS_FILE" | grep -v "#" | tr '\n' '#' | \
sed 's/\\\\#//g' | tr -s ' ' '+' | tr -s '#' ' ' | \
sed 's/+c/+$brotli/g' | sed 's/+=+/=/g'`
for ITEM in ${BROTLI_LISTS}; do
VAR=`echo $ITEM | sed 's/=.*//'`
VAL=`echo $ITEM | sed 's/.*=//' | tr '+' ' '`
eval ${VAR}=\"$VAL\"
done
else # BROTLI_LISTS_FILE
BROTLI_ENC_H="$brotli/include/brotli/encode.h \
$brotli/include/brotli/port.h \
$brotli/include/brotli/types.h"
BROTLI_ENC_LIB="-lbrotlienc"
fi
ngx_module_incs="$brotli/include"
ngx_module_deps="$BROTLI_COMMON_H $BROTLI_ENC_H"
ngx_module_srcs="$BROTLI_COMMON_C $BROTLI_ENC_C \
$BROTLI_MODULE_SRC_DIR/ngx_http_brotli_filter_module.c"
ngx_module_libs="$BROTLI_ENC_LIB -lm"
ngx_module_order="$ngx_module_name \
ngx_pagespeed \
ngx_http_postpone_filter_module \
ngx_http_ssi_filter_module \
ngx_http_charset_filter_module \
ngx_http_xslt_filter_module \
ngx_http_image_filter_module \
ngx_http_sub_filter_module \
ngx_http_addition_filter_module \
ngx_http_gunzip_filter_module \
ngx_http_userid_filter_module \
ngx_http_headers_filter_module \
ngx_http_copy_filter_module \
ngx_http_range_body_filter_module \
ngx_http_not_modified_filter_module \
ngx_http_slice_filter_module"
. auto/module
if [ "$ngx_module_link" != DYNAMIC ]; then
# ngx_module_order doesn't work with static modules,
# so we must re-order filters here.
if [ "$HTTP_GZIP" = YES ]; then
next=ngx_http_gzip_filter_module
elif echo $HTTP_FILTER_MODULES | grep pagespeed_etag_filter >/dev/null; then
next=ngx_pagespeed_etag_filter
else
next=ngx_http_range_header_filter_module
fi
HTTP_FILTER_MODULES=`echo $HTTP_FILTER_MODULES \
| sed "s/$ngx_module_name//" \
| sed "s/$next/$next $ngx_module_name/"`
fi
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
have=NGX_HTTP_BROTLI_FILTER . auto/have
have=NGX_HTTP_BROTLI_FILTER_MODULE . auto/have # deprecated
This diff is collapsed.
#!/bin/bash
set -ex
# Setup shortcuts.
ROOT=`pwd`
FILES=$ROOT/script/test
# Setup directory structure.
cd $ROOT/script
mkdir test
cd test
mkdir logs
# Download sample texts.
curl --compressed -o $FILES/war-and-peace.txt http://www.gutenberg.org/files/2600/2600-0.txt
echo "Kot lomom kolol slona!" > $FILES/small.txt
# Restore status-quo.
cd $ROOT
#!/bin/bash
set -ex
# Setup shortcuts.
ROOT=`pwd`
# Clone nginx read-only git repository.
if [ ! -d "nginx" ]; then
git clone https://github.com/nginx/nginx.git
fi
# Build nginx + filter module.
cd $ROOT/nginx
# Pro memoria: --with-debug
./auto/configure --prefix=$ROOT/script/test --add-module=$ROOT
make -j 16
# Build brotli CLI.
cd $ROOT/deps/brotli
mkdir out
cd out
cmake ..
make -j 16 brotli
# Restore status-quo.
cd $ROOT
#!/bin/bash
# Setup shortcuts.
ROOT=`pwd`
NGINX=$ROOT/nginx/objs/nginx
BROTLI=$ROOT/deps/brotli/out/brotli
SERVER=http://localhost:8080
FILES=$ROOT/script/test
HR="---------------------------------------------------------------------------"
# fail / count
STATUS="0 0"
add_result() {
is_success=$3
num_success=`expr $1 + $is_success`
num_tests=`expr $2 + 1`
echo "$num_success $num_tests"
}
get_failed() {
echo $1
}
get_count() {
echo $2
}
expect_equal() {
status=$1
expected=$2
actual=$3
if cmp $expected $actual; then
echo "OK" >&2
echo $(add_result $status 0)
else
echo "FAIL (equality)" >&2
echo $(add_result $status 1)
fi
}
expect_br_equal() {
status=$1
expected=$2
actual_br=$3
if $BROTLI -dfk ./${actual_br}.br; then
echo $(expect_equal "$status" $expected $actual_br)
else
echo "FAIL (decompression)" >&2
echo $(add_result $status 1)
fi
}
# Start server.
echo "Statring NGINX"
$NGINX -c $ROOT/script/test.conf
# Fetch vanilla 404 response.
curl -s -o ./notfound.txt $SERVER/notfound
# Run tests.
echo $HR
echo "Test: long file with rate limit"
curl -s -H 'Accept-encoding: br' -o ./war-and-peace.br --limit-rate 300K $SERVER/war-and-peace.txt
STATUS=$(expect_br_equal "$STATUS" $FILES/war-and-peace.txt ./war-and-peace)
echo "Test: compressed 404"
curl -s -H 'Accept-encoding: br' -o ./notfound.br $SERVER/notfound
STATUS=$(expect_br_equal "$STATUS" ./notfound.txt ./notfound)
echo "Test: A-E: 'gzip, br'"
curl -s -H 'Accept-encoding: gzip, br' -o ./ae-01.br $SERVER/small.txt
STATUS=$(expect_br_equal "$STATUS" $FILES/small.txt ./ae-01)
echo "Test: A-E: 'gzip, br, deflate'"
curl -s -H 'Accept-encoding: gzip, br, deflate' -o ./ae-02.br $SERVER/small.txt
STATUS=$(expect_br_equal "$STATUS" $FILES/small.txt ./ae-02)
echo "Test: A-E: 'gzip, br;q=1, deflate'"
curl -s -H 'Accept-encoding: gzip, br;q=1, deflate' -o ./ae-03.br $SERVER/small.txt
STATUS=$(expect_br_equal "$STATUS" $FILES/small.txt ./ae-03)
echo "Test: A-E: 'br;q=0.001'"
curl -s -H 'Accept-encoding: br;q=0.001' -o ./ae-04.br $SERVER/small.txt
STATUS=$(expect_br_equal "$STATUS" $FILES/small.txt ./ae-04)
echo "Test: A-E: 'bro'"
curl -s -H 'Accept-encoding: bro' -o ./ae-05.txt $SERVER/small.txt
STATUS=$(expect_equal "$STATUS" $FILES/small.txt ./ae-05.txt)
echo "Test: A-E: 'bo'"
curl -s -H 'Accept-encoding: bo' -o ./ae-06.txt $SERVER/small.txt
STATUS=$(expect_equal "$STATUS" $FILES/small.txt ./ae-06.txt)
echo "Test: A-E: 'br;q=0'"
curl -s -H 'Accept-encoding: br;q=0' -o ./ae-07.txt $SERVER/small.txt
STATUS=$(expect_equal "$STATUS" $FILES/small.txt ./ae-07.txt)
echo "Test: A-E: 'br;q=0.'"
curl -s -H 'Accept-encoding: br;q=0.' -o ./ae-08.txt $SERVER/small.txt
STATUS=$(expect_equal "$STATUS" $FILES/small.txt ./ae-08.txt)
echo "Test: A-E: 'br;q=0.0'"
curl -s -H 'Accept-encoding: br;q=0.0' -o ./ae-09.txt $SERVER/small.txt
STATUS=$(expect_equal "$STATUS" $FILES/small.txt ./ae-09.txt)
echo "Test: A-E: 'br;q=0.00'"
curl -s -H 'Accept-encoding: br;q=0.00' -o ./ae-10.txt $SERVER/small.txt
STATUS=$(expect_equal "$STATUS" $FILES/small.txt ./ae-10.txt)
echo "Test: A-E: 'br ; q = 0.000'"
curl -s -H 'Accept-encoding: br ; q = 0.000' -o ./ae-11.txt $SERVER/small.txt
STATUS=$(expect_equal "$STATUS" $FILES/small.txt ./ae-11.txt)
# Report.
FAILED=$(get_failed $STATUS)
COUNT=$(get_count $STATUS)
echo $HR
echo "Results: $FAILED of $COUNT tests failed"
echo $HR
echo "Stopping NGINX"
# Stop server.
$NGINX -c $ROOT/script/test.conf -s stop
# Restore status-quo.
cd $ROOT
exit $FAILED
events {
worker_connections 4;
}
daemon on;
error_log /dev/stdout info;
http {
access_log ./access.log;
error_log ./error.log;
gzip on;
gzip_comp_level 1;
gzip_types text/plain text/css;
brotli on;
brotli_comp_level 1;
brotli_types text/plain text/css;
server {
listen 8080 default_server;
listen [::]:8080 default_server;
root ./;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
}
# Copyright (C) 2015-2019 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
if [ "$ngx_addon_name" = "ngx_brotli" ]; then
BROTLI_MODULE_SRC_DIR="$ngx_addon_dir/static"
else
BROTLI_MODULE_SRC_DIR="$ngx_addon_dir"
fi
ngx_addon_name=ngx_brotli_static
if [ -z "$ngx_module_link" ]; then
cat << END
$0: error: Brotli module requires recent version of NGINX (1.9.11+).
END
exit 1
fi
ngx_module_type=HTTP
ngx_module_name=ngx_http_brotli_static_module
ngx_module_incs=
ngx_module_deps=
ngx_module_srcs="$BROTLI_MODULE_SRC_DIR/ngx_http_brotli_static_module.c"
ngx_module_libs=
ngx_module_order=
. auto/module
have=NGX_HTTP_GZIP . auto/have
have=NGX_HTTP_BROTLI_STATIC . auto/have
have=NGX_HTTP_BROTLI_STATIC_MODULE . auto/have # deprecated
This diff is collapsed.
......@@ -67,7 +67,7 @@ Version: 1.2.1
Module: http-upsync
Homepage: https://github.com/weibocom/nginx-upsync-module
Version: v2.1.0
Version: 2.1.1
Module: http-vhost-traffic-status
Homepage: https://github.com/vozlt/nginx-module-vts
......@@ -83,7 +83,7 @@ Version: 219131a
Module: http-geoip2
Homepage: https://github.com/leev/ngx_http_geoip2_module
Version: 3.2
Version: 3.3
Module: stream-server-traffic-status
Homepage: https://github.com/vozlt/nginx-module-stream-sts
......@@ -93,3 +93,6 @@ Module: http-stream-server-traffic-status
Homepage: https://github.com/vozlt/nginx-module-sts
Version: v0.1.1
Module: brotli
Homepage: https://github.com/google/ngx_brotli
Version: master
......@@ -35,7 +35,7 @@ if [ $ngx_found = yes ]; then
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_geoip2_module.c"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
fi
else
else
cat << END
$0: error: the geoip2 module requires the maxminddb library.
END
......
......@@ -23,10 +23,11 @@ typedef struct {
#else
unsigned long address;
#endif
ngx_queue_t queue;
} ngx_http_geoip2_db_t;
typedef struct {
ngx_array_t *databases;
ngx_queue_t databases;
ngx_array_t *proxies;
ngx_flag_t proxy_recursive;
} ngx_http_geoip2_conf_t;
......@@ -345,6 +346,8 @@ ngx_http_geoip2_create_conf(ngx_conf_t *cf)
return NULL;
}
ngx_queue_init(&conf->databases);
cln->handler = ngx_http_geoip2_cleanup;
cln->data = conf;
......@@ -357,10 +360,11 @@ ngx_http_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_geoip2_conf_t *gcf = conf;
ngx_str_t *value;
int status, nelts, i;
int status;
ngx_http_geoip2_db_t *database;
char *rv;
ngx_conf_t save;
ngx_queue_t *q;
value = cf->args->elts;
......@@ -370,18 +374,13 @@ ngx_http_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
}
if (gcf->databases == NULL) {
gcf->databases = ngx_array_create(cf->pool, 2,
sizeof(ngx_http_geoip2_db_t));
if (gcf->databases == NULL) {
return NGX_CONF_ERROR;
}
} else {