From bcd6a67bc063e0ec4fd4506f7d573d24cac8fb06 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 4 Aug 2014 14:27:57 +0200 Subject: [PATCH] Don't advertise deflate compression support. There is some misunderstanding on what the "deflate" is, and we can't reliably decode it in all cases. So, don't advertise support for it and let servers use gzip (or no compression) instead. Fixes #11093 --- src/kits/network/libnetapi/HttpRequest.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/kits/network/libnetapi/HttpRequest.cpp b/src/kits/network/libnetapi/HttpRequest.cpp index 6e9c431ade..7f880036cd 100644 --- a/src/kits/network/libnetapi/HttpRequest.cpp +++ b/src/kits/network/libnetapi/HttpRequest.cpp @@ -553,6 +553,9 @@ BHttpRequest::_MakeRequest() readByChunks = true; BString contentEncoding(fHeaders["Content-Encoding"]); + // We don't advertise "deflate" support (see above), but we + // still try to decompress it, if a server ever sends a deflate + // stream despite it not being in our Accept-Encoding list. if (contentEncoding == "gzip" || contentEncoding == "deflate") { decompress = true; @@ -829,10 +832,12 @@ BHttpRequest::_SendHeaders() outputHeaders.AddHeader("Host", host); outputHeaders.AddHeader("Accept", "*/*"); - outputHeaders.AddHeader("Accept-Encoding", "gzip,deflate"); - // Allow the remote server to send dynamic content by chunks - // rather than waiting for the full content to be generated and - // sending us data. + outputHeaders.AddHeader("Accept-Encoding", "gzip"); + // Allows the server to compress data using the "gzip" format. + // "deflate" is not supported, because there are two interpretations + // of what it means (the RFC and Microsoft products), and we don't + // want to handle this. Very few websites support only deflate, + // and most of them will send gzip, or at worst, uncompressed data. outputHeaders.AddHeader("Connection", "close"); // Let the remote server close the connection after response since