apache /
serf /
c1660bab73a87a2dddb2b239b7d06b7f2d8ffd44 Add support for decompressing Brotli (RFC 7932) data and allow decoding
"Content-Encoding: br" responses.
The patch introduces an optional dependency on the Brotli library from
https://github.com/google/brotli and a new bucket that allows decoding
Brotli data. The new bucket features zero-copy processing, which is only
possible with the new API from the upcoming 1.0.x series of the library.
* serf_bucket_types.h
(serf_bucket_is_brotli_supported,
serf_bucket_brotli_decompress_create): Declare new functions.
(SERF_BUCKET_IS_BROTLI_DECOMPRESS,
serf_bucket_brotli_decompress_create): Declare new bucket type.
* buckets/brotli_buckets.c:
New file containing the implementation of the new bucket. Brotli is
an optional dependency, so provide function stubs if it is not supported
and indicate that in serf_bucket_is_brotli_supported().
* buckets/response_buckets.c
(run_machine): Decode "Content-Encoding: br" if Brotli is supported.
* test/serf_bwtp.c
(setup_request, setup_channel): Indicate Brotli support in "Accept-Encoding".
* test/serf_get.c
(setup_request): Indicate Brotli support in "Accept-Encoding".
* test/serf_spider.c
(setup_request): Indicate Brotli support in "Accept-Encoding".
* test/test_buckets.c
(test_brotli_decompress_bucket_basic,
test_brotli_decompress_bucket_truncated_input,
test_brotli_decompress_bucket_read_bytewise,
test_brotli_decompress_bucket_chunked_input,
test_brotli_decompress_bucket_chunked_input2,
test_brotli_decompress_bucket_garbage_at_end,
test_brotli_decompress_response_body): New tests.
(test_buckets): Run new tests if Serf is built with Brotli support.
* SConstruct: Pick up location of the Brotli library from the new
BROTLI variable. In case it's set, ensure that we are building
with an appropriate version of the library and define SERF_HAVE_BROTLI.
Approved by: rhuijben
git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1786654 13f79535-47bb-0310-9956-ffa450edef68
8 files changed