<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>63696</bug_id>
          
          <creation_ts>2011-06-30 02:40:21 -0700</creation_ts>
          <short_desc>Custom Accept-Encoding header prevents autoDecompress</short_desc>
          <delta_ts>2022-07-29 10:53:33 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Qt</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc>http://developer.qt.nokia.com/forums/viewthread/2357/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Thijs">ttf11</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>markus</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>430294</commentid>
    <comment_count>0</comment_count>
    <who name="Thijs">ttf11</who>
    <bug_when>2011-06-30 02:40:21 -0700</bug_when>
    <thetext>When you set a custom &quot;Accept-Encoding&quot; raw header on a QNetworkRequest object (for example via an overridden QNetworkAccessManager::createRequest() ), QtWebKit will never decompress the reply anymore:

source code of qhttpnetworkconnection.cpp :

====================
    value = request.headerField(&quot;accept-encoding&quot;);
    if (value.isEmpty()) {
#ifndef QT_NO_COMPRESS
        request.setHeaderField(&quot;Accept-Encoding&quot;, &quot;gzip&quot;);
        request.d-&gt;autoDecompress = true;
#else
        // if zlib is not available set this to false always
        request.d-&gt;autoDecompress = false;
#endif
    }
====================

If the &quot;accept-encoding&quot; header was already set, request.d-&gt;autoDecompress is never set to true. This is even true if you manually set the header to &quot;gzip&quot; for example.

The solution consists of two parts:
1) If the current value contains &quot;gzip&quot;, also set autoDecompress to true
2) add a custom method to manually set autoDecompress to true (useful if you do not want gzipped data, but if the server still sends it, then decode it anyway as a fallback method)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>430300</commentid>
    <comment_count>1</comment_count>
    <who name="Markus Goetz">markus</who>
    <bug_when>2011-06-30 02:59:37 -0700</bug_when>
    <thetext>That&apos;s not a bug. If you set the header on the QNetworkRequest you are basically telling QNetworkAccessManager &quot;I know what I&apos;m doing, please don&apos;t do any content encoding processing&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>430302</commentid>
    <comment_count>2</comment_count>
    <who name="Thijs">ttf11</who>
    <bug_when>2011-06-30 03:13:17 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; That&apos;s not a bug. If you set the header on the QNetworkRequest you are basically telling QNetworkAccessManager &quot;I know what I&apos;m doing, please don&apos;t do any content encoding processing&quot;.

If that&apos;s true, then the documentation should clearly point this out. It doesn&apos;t mention anywhere that if you set the Accept-Encoding manually, you will not get auto-decompression anymore. Especially if you set &quot;gzip&quot; (same as Qt does), this is very surprising.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>430324</commentid>
    <comment_count>3</comment_count>
    <who name="Thijs">ttf11</who>
    <bug_when>2011-06-30 04:39:33 -0700</bug_when>
    <thetext>Changed from &quot;bug&quot; to &quot;enhancement&quot; request</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1887694</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-07-29 10:53:33 -0700</bug_when>
    <thetext>The Qt port has been removed from WebKit, resolving this bug.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>