Bug 63696 - Custom Accept-Encoding header prevents autoDecompress
Summary: Custom Accept-Encoding header prevents autoDecompress
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Enhancement
Assignee: Nobody
URL: http://developer.qt.nokia.com/forums/...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-30 02:40 PDT by Thijs
Modified: 2022-07-29 10:53 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thijs 2011-06-30 02:40:21 PDT
When you set a custom "Accept-Encoding" 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("accept-encoding");
    if (value.isEmpty()) {
#ifndef QT_NO_COMPRESS
        request.setHeaderField("Accept-Encoding", "gzip");
        request.d->autoDecompress = true;
#else
        // if zlib is not available set this to false always
        request.d->autoDecompress = false;
#endif
    }
====================

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

The solution consists of two parts:
1) If the current value contains "gzip", 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)
Comment 1 Markus Goetz 2011-06-30 02:59:37 PDT
That's not a bug. If you set the header on the QNetworkRequest you are basically telling QNetworkAccessManager "I know what I'm doing, please don't do any content encoding processing".
Comment 2 Thijs 2011-06-30 03:13:17 PDT
(In reply to comment #1)
> That's not a bug. If you set the header on the QNetworkRequest you are basically telling QNetworkAccessManager "I know what I'm doing, please don't do any content encoding processing".

If that's true, then the documentation should clearly point this out. It doesn't mention anywhere that if you set the Accept-Encoding manually, you will not get auto-decompression anymore. Especially if you set "gzip" (same as Qt does), this is very surprising.
Comment 3 Thijs 2011-06-30 04:39:33 PDT
Changed from "bug" to "enhancement" request
Comment 4 Alexey Proskuryakov 2022-07-29 10:53:33 PDT
The Qt port has been removed from WebKit, resolving this bug.