From df80ca892fbb2f2464c2c6ba503fe7bf9f3f083f Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 5 Jan 2020 04:51:59 +0300 Subject: [PATCH] Prefer brotli over other compression methods in HTTP --- dbms/programs/server/HTTPHandler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dbms/programs/server/HTTPHandler.cpp b/dbms/programs/server/HTTPHandler.cpp index 34a0093e9a6..a93a88a0d5b 100644 --- a/dbms/programs/server/HTTPHandler.cpp +++ b/dbms/programs/server/HTTPHandler.cpp @@ -302,14 +302,16 @@ void HTTPHandler::processQuery( if (!http_response_compression_methods.empty()) { + /// If client supports brotli - it's preferred. /// Both gzip and deflate are supported. If the client supports both, gzip is preferred. /// NOTE parsing of the list of methods is slightly incorrect. - if (std::string::npos != http_response_compression_methods.find("gzip")) + + if (http_response_compression_methods == "br") + http_response_compression_method = CompressionMethod::Brotli; + else if (std::string::npos != http_response_compression_methods.find("gzip")) http_response_compression_method = CompressionMethod::Gzip; else if (std::string::npos != http_response_compression_methods.find("deflate")) http_response_compression_method = CompressionMethod::Zlib; - else if (http_response_compression_methods == "br") - http_response_compression_method = CompressionMethod::Brotli; } bool client_supports_http_compression = http_response_compression_method != CompressionMethod::None;