Title: [173809] trunk
Revision
173809
Author
[email protected]
Date
2014-09-22 01:15:32 -0700 (Mon, 22 Sep 2014)

Log Message

[GStreamer] Cannot play Vimeo video
https://bugs.webkit.org/show_bug.cgi?id=134969

Reviewed by Sergio Villar Senin.

Source/WebCore:

Ensure the GStreamer HTTP source element also sends cookies when
it's sending its requests. Some streaming platforms such as Vimeo
do server-side cookie checks on incoming requests before serving
media data.

Test: http/tests/media/hls/video-cookie.html

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcStart): Set first-party cookie URL to the request so
the ResourceLoader properly sets cookies in the HTTP request.

LayoutTests:

New test for a HLS stream enforcing a specific cookie before
serving its fragments, like Vimeo does.

* http/tests/media/hls/video-cookie-expected.txt: Added.
* http/tests/media/hls/video-cookie.html: Added.
* http/tests/media/resources/hls/playlist-with-cookie.m3u8: Added.
* http/tests/media/resources/hls/sub-playlist-with-cookie.php: Added.
* http/tests/media/resources/video-cookie-check-cookie.php:
* platform/gtk/TestExpectations: Marked test as slow, as the other
HLS test.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (173808 => 173809)


--- trunk/LayoutTests/ChangeLog	2014-09-22 07:51:54 UTC (rev 173808)
+++ trunk/LayoutTests/ChangeLog	2014-09-22 08:15:32 UTC (rev 173809)
@@ -1,3 +1,21 @@
+2014-09-17  Philippe Normand  <[email protected]>
+
+        [GStreamer] Cannot play Vimeo video
+        https://bugs.webkit.org/show_bug.cgi?id=134969
+
+        Reviewed by Sergio Villar Senin.
+
+        New test for a HLS stream enforcing a specific cookie before
+        serving its fragments, like Vimeo does.
+
+        * http/tests/media/hls/video-cookie-expected.txt: Added.
+        * http/tests/media/hls/video-cookie.html: Added.
+        * http/tests/media/resources/hls/playlist-with-cookie.m3u8: Added.
+        * http/tests/media/resources/hls/sub-playlist-with-cookie.php: Added.
+        * http/tests/media/resources/video-cookie-check-cookie.php:
+        * platform/gtk/TestExpectations: Marked test as slow, as the other
+        HLS test.
+
 2014-09-22  Mihnea Ovidenie  <[email protected]>
 
         [CSS Regions] Assertion failure and null dereference crash when using animations and regions

Added: trunk/LayoutTests/http/tests/media/hls/video-cookie-expected.txt (0 => 173809)


--- trunk/LayoutTests/http/tests/media/hls/video-cookie-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/hls/video-cookie-expected.txt	2014-09-22 08:15:32 UTC (rev 173809)
@@ -0,0 +1,4 @@
+
+EVENT(play)
+END OF TEST
+

Added: trunk/LayoutTests/http/tests/media/hls/video-cookie.html (0 => 173809)


--- trunk/LayoutTests/http/tests/media/hls/video-cookie.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/hls/video-cookie.html	2014-09-22 08:15:32 UTC (rev 173809)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+        <script src=""
+        <script>
+            if (window.testRunner) {
+                testRunner.dumpAsText();
+                testRunner.setAlwaysAcceptCookies(true);
+                testRunner.waitUntilDone();
+            }
+
+            function start() {
+                video = document.getElementById('video');
+                waitForEventAndEnd('play');
+                waitForEventAndFail('stalled');
+                video.src = ""
+            }
+        </script>
+    </head>
+    <body _onload_="start()">
+        <video id="video" autoplay></video>
+    </body>
+</html>

Added: trunk/LayoutTests/http/tests/media/resources/hls/playlist-with-cookie.m3u8 (0 => 173809)


--- trunk/LayoutTests/http/tests/media/resources/hls/playlist-with-cookie.m3u8	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/resources/hls/playlist-with-cookie.m3u8	2014-09-22 08:15:32 UTC (rev 173809)
@@ -0,0 +1,5 @@
+#EXTM3U
+
+#EXT-X-STREAM-INF:PROGRAM-ID=1
+sub-playlist-with-cookie.php
+

Added: trunk/LayoutTests/http/tests/media/resources/hls/sub-playlist-with-cookie.php (0 => 173809)


--- trunk/LayoutTests/http/tests/media/resources/hls/sub-playlist-with-cookie.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/resources/hls/sub-playlist-with-cookie.php	2014-09-22 08:15:32 UTC (rev 173809)
@@ -0,0 +1,32 @@
+<?php
+# See the HLS ITEF spec: <http://tools.ietf.org/id/draft-pantos-http-live-streaming-12.txt>
+header("Status: 200 OK");
+header("HTTP/1.1 200 OK");
+header("Connection: close");
+header('Cache-Control: no-store, no-cache="set-cookie"\n');
+header("Access-Control-Allow-Origin: *");
+header("Etag: " . '"' . filesize(__FILE__) . "-" . filemtime(__FILE__) . '"');
+header("Set-Cookie: TEST=test.ts; path=/media/resources/");
+header("Content-Type: application/x-mpegurl");
+header("Content-Length: " . filesize(__FILE__));
+
+$chunkDuration = 6.0272;
+$chunkCount = 4;
+
+function println($string) { return print($string . PHP_EOL); }
+
+println("#EXTM3U");
+println("#EXT-X-TARGETDURATION:7");
+println("#EXT-X-VERSION:4");
+println("#EXT-X-MEDIA-SEQUENCE:" . (time() / $chunkDuration % 100));
+
+$time = time();
+$time = $time - $time % $chunkDuration;
+
+for ($i = 0; $i < $chunkCount; ++$i) {
+    $time += 6;
+    println("#EXT-X-PROGRAM-DATE-TIME:" . gmdate("c", $time));
+    println("#EXTINF:" . $chunkDuration . ",");
+    println("../video-cookie-check-cookie.php");
+}
+?>

Modified: trunk/LayoutTests/http/tests/media/resources/video-cookie-check-cookie.php (173808 => 173809)


--- trunk/LayoutTests/http/tests/media/resources/video-cookie-check-cookie.php	2014-09-22 07:51:54 UTC (rev 173808)
+++ trunk/LayoutTests/http/tests/media/resources/video-cookie-check-cookie.php	2014-09-22 08:15:32 UTC (rev 173809)
@@ -1,14 +1,16 @@
 <?php
     if($_COOKIE["TEST"])
     {
-        $extension = substr($_COOKIE["TEST"], -3);
-
+        $extension = pathinfo($_COOKIE["TEST"], PATHINFO_EXTENSION);
         if ($extension == 'mp4') {
                header("Content-Type: video/mp4");
                $fileName = "test.mp4";
         } else if ($extension == 'ogv') {
                header("Content-Type: video/ogg");
                $fileName = "test.ogv";
+        } else if ($extension == 'ts') {
+               header("Content-Type: video/mpegts");
+               $fileName = "hls/test.ts";
         } else
                die;
 

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (173808 => 173809)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2014-09-22 07:51:54 UTC (rev 173808)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2014-09-22 08:15:32 UTC (rev 173809)
@@ -1028,6 +1028,8 @@
 
 webkit.org/b/119264 transitions/created-while-suspended.html [ Pass Slow ]
 
+Bug(GTK) http/tests/media/hls/video-cookie.html [ Pass Slow ]
+
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of slow tests
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/LayoutTests/platform/mac/TestExpectations (173808 => 173809)


--- trunk/LayoutTests/platform/mac/TestExpectations	2014-09-22 07:51:54 UTC (rev 173808)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2014-09-22 08:15:32 UTC (rev 173809)
@@ -1387,3 +1387,5 @@
 webkit.org/b/135390 fast/css/fontloader-multiple-families.html [ Pass ]
 webkit.org/b/135390 fast/css/fontloader-page-cache.html [ Pass ]
 webkit.org/b/135390 http/tests/webfont/fontloader-loading-attribute.html [ Pass ]
+
+webkit.org/b/136994 http/tests/media/hls/video-cookie.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (173808 => 173809)


--- trunk/Source/WebCore/ChangeLog	2014-09-22 07:51:54 UTC (rev 173808)
+++ trunk/Source/WebCore/ChangeLog	2014-09-22 08:15:32 UTC (rev 173809)
@@ -1,3 +1,21 @@
+2014-09-17  Philippe Normand  <[email protected]>
+
+        [GStreamer] Cannot play Vimeo video
+        https://bugs.webkit.org/show_bug.cgi?id=134969
+
+        Reviewed by Sergio Villar Senin.
+
+        Ensure the GStreamer HTTP source element also sends cookies when
+        it's sending its requests. Some streaming platforms such as Vimeo
+        do server-side cookie checks on incoming requests before serving
+        media data.
+
+        Test: http/tests/media/hls/video-cookie.html
+
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (webKitWebSrcStart): Set first-party cookie URL to the request so
+        the ResourceLoader properly sets cookies in the HTTP request.
+
 2014-09-22  Mihnea Ovidenie  <[email protected]>
 
         Leverage RenderLayerBacking::renderer() instead of m_owningLayer.renderer()

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (173808 => 173809)


--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2014-09-22 07:51:54 UTC (rev 173808)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2014-09-22 08:15:32 UTC (rev 173809)
@@ -464,6 +464,7 @@
 
     ResourceRequest request(url);
     request.setAllowCookies(true);
+    request.setFirstPartyForCookies(url);
 
     if (priv->player)
         request.setHTTPReferrer(priv->player->referrer());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to