|author||Piotr Sikora <email@example.com>||Thu Mar 17 15:53:27 2016 -0700|
|committer||Piotr Sikora <firstname.lastname@example.org>||Tue Apr 19 22:59:24 2016 +0000|
Brotli: fix handling of upstream read timeout. Output filters receive only special buffer with "flush" flag set in case when upstream sent headers, but timed out before sending request body. Previously, this case wasn't handled correctly, because of the wrong assumption that Brotli compressor always produces output when called with "flush" parameter, which isn't the case if there is no input to compress. Reported by Tomas Kvasnicka on GitHub (issue #20). Change-Id: I96dacc625c9c2509276800d7ac80a2d622a95463 Signed-off-by: Piotr Sikora <email@example.com> Reviewed-on: https://nginx-review.googlesource.com/1110 Reviewed-by: Martin Maly <firstname.lastname@example.org>
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:
Both Brotli library and nginx module are under active development.
$ cd nginx-1.x.x $ ./configure --add-module=/path/to/ngx_brotli $ make && make install
ngx_brotli filter module depends on libbrotli, which must be installed on the target system for it to work.
Alternatively, ngx_brotli static module can be compiled into nginx by itself with
NGX_BROTLI_STATIC_MODULE_ONLY=1 defined in the environment:
$ cd nginx-1.x.x $ export NGX_BROTLI_STATIC_MODULE_ONLY=1 $ ./configure --add-module=/path/to/ngx_brotli $ make && make install
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.
Enables or disables on-the-fly compression of responses.
brotli_types <mime_type> [..]
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 <number> <size>
32 4k|16 8k
size of buffers used to compress a response. By default, the buffer size is equal to one memory page. This is either
8k, depending on a platform.
Sets Brotli quality (compression)
level. Acceptable values are in the range from
Sets Brotli window
size. Acceptable values are
Sets the minimum
length of a response that will be compressed. The length is determined only from the
Content-Length response header field.
Achieved compression ratio, computed as the ratio between the original and compressed response sizes.
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.