From 825840f6291aab477462018053f104177980e52b Mon Sep 17 00:00:00 2001 From: Arkadii Shapkin Date: Thu, 6 Feb 2020 12:08:14 +0300 Subject: [PATCH 1/3] Enable compression on all platform where To can set CPPREST_EXCLUDE_COMPRESSION=ON to disable compression --- Release/src/http/common/http_compression.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Release/src/http/common/http_compression.cpp b/Release/src/http/common/http_compression.cpp index a65adc2468..c7fee49860 100644 --- a/Release/src/http/common/http_compression.cpp +++ b/Release/src/http/common/http_compression.cpp @@ -17,18 +17,9 @@ // it. CPPREST_EXCLUDE_BROTLI is set if we want to explicitly disable Brotli compression support. // CPPREST_EXCLUDE_WEBSOCKETS is a flag that now essentially means "no external dependencies". TODO: Rename -#if __APPLE__ -#include "TargetConditionals.h" -#if defined(TARGET_OS_MAC) -#if !defined(CPPREST_EXCLUDE_COMPRESSION) -#define CPPREST_HTTP_COMPRESSION -#endif // !defined(CPPREST_EXCLUDE_COMPRESSION) -#endif // defined(TARGET_OS_MAC) -#elif defined(_WIN32) && (!defined(WINAPI_FAMILY) || WINAPI_PARTITION_DESKTOP) #if !defined(CPPREST_EXCLUDE_WEBSOCKETS) && !defined(CPPREST_EXCLUDE_COMPRESSION) #define CPPREST_HTTP_COMPRESSION #endif // !defined(CPPREST_EXCLUDE_WEBSOCKETS) && !defined(CPPREST_EXCLUDE_COMPRESSION) -#endif #if defined(CPPREST_HTTP_COMPRESSION) #include From 5722baf118fdfdfc17e96640cbe63812c361c8dd Mon Sep 17 00:00:00 2001 From: Arkady Shapkin Date: Wed, 5 Feb 2020 18:06:55 +0300 Subject: [PATCH 2/3] Divided the uri_address compression test into several to make it easier to detect which one failed --- .../functional/http/client/compression_tests.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Release/tests/functional/http/client/compression_tests.cpp b/Release/tests/functional/http/client/compression_tests.cpp index dd6e49f3ce..46ac3f42ac 100644 --- a/Release/tests/functional/http/client/compression_tests.cpp +++ b/Release/tests/functional/http/client/compression_tests.cpp @@ -376,19 +376,31 @@ SUITE(compression_tests) } } - TEST_FIXTURE(uri_address, compress_and_decompress) + TEST_FIXTURE(uri_address, compress_and_decompress_fake) { compress_test(nullptr, nullptr); // FAKE + } + + TEST_FIXTURE(uri_address, compress_and_decompress_gzip) + { if (builtin::algorithm::supported(builtin::algorithm::GZIP)) { compress_test(builtin::get_compress_factory(builtin::algorithm::GZIP), builtin::get_decompress_factory(builtin::algorithm::GZIP)); } + } + + TEST_FIXTURE(uri_address, compress_and_decompress_deflate) + { if (builtin::algorithm::supported(builtin::algorithm::DEFLATE)) { compress_test(builtin::get_compress_factory(builtin::algorithm::DEFLATE), builtin::get_decompress_factory(builtin::algorithm::DEFLATE)); } + } + + TEST_FIXTURE(uri_address, compress_and_decompress_brotli) + { if (builtin::algorithm::supported(builtin::algorithm::BROTLI)) { compress_test(builtin::get_compress_factory(builtin::algorithm::BROTLI), From 015d7fe40d55838708d109195e891d438db2cfae Mon Sep 17 00:00:00 2001 From: Arkady Shapkin Date: Wed, 5 Feb 2020 18:51:25 +0300 Subject: [PATCH 3/3] Fix decompression with zlib 1.2.8 --- Release/src/http/common/http_compression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Release/src/http/common/http_compression.cpp b/Release/src/http/common/http_compression.cpp index c7fee49860..1596ddca86 100644 --- a/Release/src/http/common/http_compression.cpp +++ b/Release/src/http/common/http_compression.cpp @@ -268,7 +268,7 @@ class gzip_compressor : public zlib_compressor_base class gzip_decompressor : public zlib_decompressor_base { public: - gzip_decompressor() : zlib_decompressor_base(16) // gzip auto-detect + gzip_decompressor() : zlib_decompressor_base(31) // 15 is MAX_WBITS in zconf.h; add 16 for gzip { } };