Title: [154977] trunk
- Revision
- 154977
- Author
- commit-qu...@webkit.org
- Date
- 2013-09-03 06:16:54 -0700 (Tue, 03 Sep 2013)
Log Message
[gstreamer] 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 <andre.magalh...@collabora.co.uk> on 2013-09-03
Reviewed by Philippe Normand.
Source/WebCore:
Also disable Accept-Encoding on ResourceRequest::toSoupMessage accordingly.
* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::toSoupMessage):
Call ResourceRequest::updateSoupMessage from ResourceRequest::toSoupMessage so that the
Accept-Encoding header is also respected.
LayoutTests:
Add test to check that video requests will send no "Accept-Encoding" header.
* http/tests/media/video-accept-encoding-expected.txt: Added.
* http/tests/media/video-accept-encoding.cgi: Added.
* http/tests/media/video-accept-encoding.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (154976 => 154977)
--- trunk/LayoutTests/ChangeLog 2013-09-03 11:29:33 UTC (rev 154976)
+++ trunk/LayoutTests/ChangeLog 2013-09-03 13:16:54 UTC (rev 154977)
@@ -1,3 +1,16 @@
+2013-09-03 Andre Moreira Magalhaes <andre.magalh...@collabora.co.uk>
+
+ [gstreamer] 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.
+
+ Add test to check that video requests will send no "Accept-Encoding" header.
+
+ * http/tests/media/video-accept-encoding-expected.txt: Added.
+ * http/tests/media/video-accept-encoding.cgi: Added.
+ * http/tests/media/video-accept-encoding.html: Added.
+
2013-09-03 Krzysztof Czech <k.cz...@samsung.com>
[AX][ATK] Added support for sort and help attributes
Added: trunk/LayoutTests/http/tests/media/video-accept-encoding-expected.txt (0 => 154977)
--- trunk/LayoutTests/http/tests/media/video-accept-encoding-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/media/video-accept-encoding-expected.txt 2013-09-03 13:16:54 UTC (rev 154977)
@@ -0,0 +1,6 @@
+Test that video requests contain no "Accept-Encoding" header.
+
+EVENT(loadedmetadata)
+loaded metadata of media file OK
+END OF TEST
+
Added: trunk/LayoutTests/http/tests/media/video-accept-encoding.cgi (0 => 154977)
--- trunk/LayoutTests/http/tests/media/video-accept-encoding.cgi (rev 0)
+++ trunk/LayoutTests/http/tests/media/video-accept-encoding.cgi 2013-09-03 13:16:54 UTC (rev 154977)
@@ -0,0 +1,86 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use CGI;
+use File::stat;
+
+use constant CHUNK_SIZE_BYTES => 1024;
+
+my $query = new CGI;
+
+my $name = $query->param('name') or die;
+my $filesize = stat($name)->size;
+
+# Get MIME type.
+my $type = $query->param('type') or die;
+
+# Get throttling rate, assuming parameter is in kilobytes per second.
+my $kbPerSec = $query->param('throttle') || 0;
+my $chunkPerSec = $kbPerSec * 1024 / CHUNK_SIZE_BYTES;
+
+CGI->nph(1);
+
+my $contentRange = $ENV{'HTTP_RANGE'};
+
+my $rangeEnd = $filesize - 1;
+my @parsedRange = (0, $rangeEnd);
+
+my $acceptEncoding = $ENV{'HTTP_ACCEPT_ENCODING'};
+
+my $httpStatus;
+
+if ($acceptEncoding) {
+ $httpStatus = "406 Not Acceptable";
+
+ print "Status: " . $httpStatus . "\n";
+ print "Connection: close\n";
+ print "\n";
+} else {
+ my $httpContentRange;
+ if ($contentRange) {
+ my @values = split('=', $contentRange);
+ my $rangeType = $values[0];
+ @parsedRange = split("-", $values[1]);
+
+ if (!$parsedRange[1]) {
+ $parsedRange[1] = $rangeEnd;
+ }
+ $httpStatus = "206 Partial Content";
+ $httpContentRange = "bytes " . $parsedRange[0] . "-" . $parsedRange[1] . "/" . $filesize;
+ } else {
+ $httpStatus = "200 OK";
+ }
+
+ print "Status: " . $httpStatus . "\n";
+ print "Connection: close\n";
+ print "Content-Length: " . $filesize . "\n";
+ print "Content-Type: " . $type . "\n";
+ print "Accept-Ranges: bytes\n";
+ if ($httpContentRange) {
+ print "Content-Range: " . $httpContentRange . "\n";
+ }
+ print "\n";
+
+ open FILE, $name or die;
+ binmode FILE;
+ my ($data, $n);
+ my $total = $parsedRange[0];
+
+ seek(FILE, $parsedRange[0], 0);
+
+ while (($n = read FILE, $data, 1024) != 0) {
+ print $data;
+
+ $total += $n;
+ if (($total >= $filesize) || ($total > $parsedRange[1])) {
+ last;
+ }
+
+ # Throttle if there is some.
+ if ($chunkPerSec > 0) {
+ select(undef, undef, undef, 1.0 / $chunkPerSec);
+ }
+ }
+ close(FILE);
+}
Property changes on: trunk/LayoutTests/http/tests/media/video-accept-encoding.cgi
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/http/tests/media/video-accept-encoding.html (0 => 154977)
--- trunk/LayoutTests/http/tests/media/video-accept-encoding.html (rev 0)
+++ trunk/LayoutTests/http/tests/media/video-accept-encoding.html 2013-09-03 13:16:54 UTC (rev 154977)
@@ -0,0 +1,30 @@
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script>
+ function start() {
+ findMediaElement();
+
+ waitForEvent('loadedmetadata', function() {
+ logResult(true, "loaded metadata of media file");
+ endTest();
+ });
+
+ waitForEvent('error', function() {
+ logResult(false, "failed to load media file");
+ endTest();
+ });
+
+ var mediaFile = findMediaFile("video", "resources/test");
+ var type = mimeTypeForExtension(mediaFile.split('.').pop());
+ video.src = "" + mediaFile + "&type=" + type;
+ video.load();
+ }
+ </script>
+ </head>
+ <body _onload_="start()">
+ <video controls></video>
+ <p>Test that video requests contain no "Accept-Encoding" header.</p>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (154976 => 154977)
--- trunk/Source/WebCore/ChangeLog 2013-09-03 11:29:33 UTC (rev 154976)
+++ trunk/Source/WebCore/ChangeLog 2013-09-03 13:16:54 UTC (rev 154977)
@@ -1,3 +1,17 @@
+2013-09-03 Andre Moreira Magalhaes <andre.magalh...@collabora.co.uk>
+
+ [gstreamer] 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.
+
+ Also disable Accept-Encoding on ResourceRequest::toSoupMessage accordingly.
+
+ * platform/network/soup/ResourceRequestSoup.cpp:
+ (WebCore::ResourceRequest::toSoupMessage):
+ Call ResourceRequest::updateSoupMessage from ResourceRequest::toSoupMessage so that the
+ Accept-Encoding header is also respected.
+
2013-09-03 Krzysztof Czech <k.cz...@samsung.com>
[AX][ATK] Added support for sort and help attributes.
Modified: trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp (154976 => 154977)
--- trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp 2013-09-03 11:29:33 UTC (rev 154976)
+++ trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp 2013-09-03 13:16:54 UTC (rev 154977)
@@ -80,16 +80,8 @@
if (!soupMessage)
return 0;
- updateSoupMessageHeaders(soupMessage->request_headers);
+ updateSoupMessage(soupMessage);
- String firstPartyString = firstPartyForCookies().string();
- if (!firstPartyString.isEmpty()) {
- GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
- soup_message_set_first_party(soupMessage, firstParty.get());
- }
-
- soup_message_set_flags(soupMessage, m_soupFlags);
-
// Body data is only handled at ResourceHandleSoup::startHttp for
// now; this is because this may not be a good place to go
// openning and mmapping files. We should maybe revisit this.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes