Bug 63696
Summary: | Custom Accept-Encoding header prevents autoDecompress | ||
---|---|---|---|
Product: | WebKit | Reporter: | Thijs <ttf11> |
Component: | WebKit Qt | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Enhancement | CC: | markus |
Priority: | P3 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://developer.qt.nokia.com/forums/viewthread/2357/ |
Thijs
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)
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Markus Goetz
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".
Thijs
(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.
Thijs
Changed from "bug" to "enhancement" request
Alexey Proskuryakov
The Qt port has been removed from WebKit, resolving this bug.