Title: [153795] trunk/Source/WebCore
- Revision
- 153795
- Author
- [email protected]
- Date
- 2013-08-07 11:40:31 -0700 (Wed, 07 Aug 2013)
Log Message
Disable HTTP request "Accept-Encoding:" header field on gstreamer source element to avoid receiving the wrong size when retrieving data
https://bugs.webkit.org/show_bug.cgi?id=115354
Patch by Andre Moreira Magalhaes <[email protected]> on 2013-08-07
Reviewed by Philippe Normand.
The default value for the HTTP "Accept-Encoding:" header field in the request allows
compressed data to be received on requests.
While this works fine for most cases, it can break the webkit source that needs to rely on the
the proper data size when receiving the response (even though the received data is already
uncompressed the size reported in ResourceResponse::expectedContentLength() is the same
represented by the HTTP header field "Content-Length" which is the size of the compressed data).
This patch disables the HTTP "Accept-Encoding:" header field when using the request
as we don't want the received response to be encoded in any way, as we need to rely on the proper
size of the returned data on ResourceHandle::didReceiveResponse().
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcStart):
* platform/network/soup/ResourceRequest.h:
(ResourceRequestBase):
(WebCore::ResourceRequest::acceptEncoding):
(WebCore::ResourceRequest::setAcceptEncoding):
(WebCore::ResourceRequest::ResourceRequestBase):
* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::updateSoupMessage):
(WebCore::ResourceRequest::toSoupMessage):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (153794 => 153795)
--- trunk/Source/WebCore/ChangeLog 2013-08-07 18:40:17 UTC (rev 153794)
+++ trunk/Source/WebCore/ChangeLog 2013-08-07 18:40:31 UTC (rev 153795)
@@ -1,3 +1,32 @@
+2013-08-07 Andre Moreira Magalhaes <[email protected]>
+
+ Disable HTTP request "Accept-Encoding:" header field on gstreamer source element to avoid receiving the wrong size when retrieving data
+ https://bugs.webkit.org/show_bug.cgi?id=115354
+
+ Reviewed by Philippe Normand.
+
+ The default value for the HTTP "Accept-Encoding:" header field in the request allows
+ compressed data to be received on requests.
+ While this works fine for most cases, it can break the webkit source that needs to rely on the
+ the proper data size when receiving the response (even though the received data is already
+ uncompressed the size reported in ResourceResponse::expectedContentLength() is the same
+ represented by the HTTP header field "Content-Length" which is the size of the compressed data).
+
+ This patch disables the HTTP "Accept-Encoding:" header field when using the request
+ as we don't want the received response to be encoded in any way, as we need to rely on the proper
+ size of the returned data on ResourceHandle::didReceiveResponse().
+
+ * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+ (webKitWebSrcStart):
+ * platform/network/soup/ResourceRequest.h:
+ (ResourceRequestBase):
+ (WebCore::ResourceRequest::acceptEncoding):
+ (WebCore::ResourceRequest::setAcceptEncoding):
+ (WebCore::ResourceRequest::ResourceRequestBase):
+ * platform/network/soup/ResourceRequestSoup.cpp:
+ (WebCore::ResourceRequest::updateSoupMessage):
+ (WebCore::ResourceRequest::toSoupMessage):
+
2013-08-07 Allan Sandfeld Jensen <[email protected]>
[Qt] REGRESSION(r) Two pixel result fail after r153522
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (153794 => 153795)
--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2013-08-07 18:40:17 UTC (rev 153794)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2013-08-07 18:40:31 UTC (rev 153795)
@@ -440,6 +440,16 @@
request.setAllowCookies(true);
request.setHTTPReferrer(priv->player->referrer());
+#if USE(SOUP)
+ // Let's disable HTTP Accept-Encoding here as we don't want the received response to be
+ // encoded in any way as we need to rely on the proper size of the returned data on
+ // didReceiveResponse.
+ // If Accept-Encoding is used, the server may send the data in encoded format and
+ // request.expectedContentLength() will have the "wrong" size (the size of the
+ // compressed data), even though the data received in didReceiveData is uncompressed.
+ request.setAcceptEncoding(false);
+#endif
+
// Let Apple web servers know we want to access their nice movie trailers.
if (!g_ascii_strcasecmp("movies.apple.com", url.host().utf8().data())
|| !g_ascii_strcasecmp("trailers.apple.com", url.host().utf8().data()))
Modified: trunk/Source/WebCore/platform/network/soup/ResourceRequest.h (153794 => 153795)
--- trunk/Source/WebCore/platform/network/soup/ResourceRequest.h 2013-08-07 18:40:17 UTC (rev 153794)
+++ trunk/Source/WebCore/platform/network/soup/ResourceRequest.h 2013-08-07 18:40:31 UTC (rev 153795)
@@ -36,18 +36,21 @@
public:
ResourceRequest(const String& url)
: ResourceRequestBase(KURL(ParsedURLString, url), UseProtocolCachePolicy)
+ , m_acceptEncoding(true)
, m_soupFlags(static_cast<SoupMessageFlags>(0))
{
}
ResourceRequest(const KURL& url)
: ResourceRequestBase(url, UseProtocolCachePolicy)
+ , m_acceptEncoding(true)
, m_soupFlags(static_cast<SoupMessageFlags>(0))
{
}
ResourceRequest(const KURL& url, const String& referrer, ResourceRequestCachePolicy policy = UseProtocolCachePolicy)
: ResourceRequestBase(url, policy)
+ , m_acceptEncoding(true)
, m_soupFlags(static_cast<SoupMessageFlags>(0))
{
setHTTPReferrer(referrer);
@@ -55,12 +58,14 @@
ResourceRequest()
: ResourceRequestBase(KURL(), UseProtocolCachePolicy)
+ , m_acceptEncoding(true)
, m_soupFlags(static_cast<SoupMessageFlags>(0))
{
}
ResourceRequest(SoupMessage* soupMessage)
: ResourceRequestBase(KURL(), UseProtocolCachePolicy)
+ , m_acceptEncoding(true)
, m_soupFlags(static_cast<SoupMessageFlags>(0))
{
updateFromSoupMessage(soupMessage);
@@ -68,6 +73,9 @@
void updateFromDelegatePreservingOldHTTPBody(const ResourceRequest& delegateProvidedRequest) { *this = delegateProvidedRequest; }
+ bool acceptEncoding() const { return m_acceptEncoding; }
+ void setAcceptEncoding(bool acceptEncoding) { m_acceptEncoding = acceptEncoding; }
+
void updateSoupMessageHeaders(SoupMessageHeaders*) const;
void updateFromSoupMessageHeaders(SoupMessageHeaders*);
void updateSoupMessage(SoupMessage*) const;
@@ -82,6 +90,7 @@
private:
friend class ResourceRequestBase;
+ bool m_acceptEncoding : 1;
SoupMessageFlags m_soupFlags;
void doUpdatePlatformRequest() { }
Modified: trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp (153794 => 153795)
--- trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp 2013-08-07 18:40:17 UTC (rev 153794)
+++ trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp 2013-08-07 18:40:31 UTC (rev 153795)
@@ -69,6 +69,9 @@
}
soup_message_set_flags(soupMessage, m_soupFlags);
+
+ if (!acceptEncoding())
+ soup_message_disable_feature(soupMessage, SOUP_TYPE_CONTENT_DECODER);
}
SoupMessage* ResourceRequest::toSoupMessage() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes