[haiku-commits] haiku: hrev47619 - src/kits/network/libnetapi

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 4 Aug 2014 14:32:07 +0200 (CEST)

hrev47619 adds 1 changeset to branch 'master'
old head: 6a18ef8358523873c8536722e009a4ab85b1049b
new head: bcd6a67bc063e0ec4fd4506f7d573d24cac8fb06
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=bcd6a67+%5E6a18ef8

----------------------------------------------------------------------------

bcd6a67: 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

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev47619
Commit:      bcd6a67bc063e0ec4fd4506f7d573d24cac8fb06
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bcd6a67
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Mon Aug  4 12:27:57 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/11093

----------------------------------------------------------------------------

1 file changed, 9 insertions(+), 4 deletions(-)
src/kits/network/libnetapi/HttpRequest.cpp | 13 +++++++++----

----------------------------------------------------------------------------

diff --git a/src/kits/network/libnetapi/HttpRequest.cpp 
b/src/kits/network/libnetapi/HttpRequest.cpp
index 6e9c431..7f88003 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


Other related posts:

  • » [haiku-commits] haiku: hrev47619 - src/kits/network/libnetapi - pulkomandy