Title: [143931] trunk
Revision
143931
Author
ser...@webkit.org
Date
2013-02-25 08:56:14 -0800 (Mon, 25 Feb 2013)

Log Message

[soup] "Too many redirects" error loading chat in plus.google.com
https://bugs.webkit.org/show_bug.cgi?id=64575

Reviewed by Martin Robinson.

Source/WebCore:

Set the firstPartyForCookies for the new request on redirects to
the URL used for redirection.

Test: http/tests/cookies/set-cookie-on-redirect.html

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::doRedirect):

LayoutTests:

This new test checks firstPartyForCookies is properly set to the
new URL on redirects.

* http/tests/cookies/resources/set-cookie-on-redirect.php: Added.
* http/tests/cookies/set-cookie-on-redirect-expected.txt: Added.
* http/tests/cookies/set-cookie-on-redirect.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143930 => 143931)


--- trunk/LayoutTests/ChangeLog	2013-02-25 16:52:38 UTC (rev 143930)
+++ trunk/LayoutTests/ChangeLog	2013-02-25 16:56:14 UTC (rev 143931)
@@ -1,3 +1,17 @@
+2013-02-25  Sergio Villar Senin  <svil...@igalia.com>
+
+        [soup] "Too many redirects" error loading chat in plus.google.com
+        https://bugs.webkit.org/show_bug.cgi?id=64575
+
+        Reviewed by Martin Robinson.
+
+        This new test checks firstPartyForCookies is properly set to the
+        new URL on redirects.
+
+        * http/tests/cookies/resources/set-cookie-on-redirect.php: Added.
+        * http/tests/cookies/set-cookie-on-redirect-expected.txt: Added.
+        * http/tests/cookies/set-cookie-on-redirect.html: Added.
+
 2013-02-25  Zoltan Arvai  <zar...@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening. Skip asserting tests.

Added: trunk/LayoutTests/http/tests/cookies/resources/set-cookie-on-redirect.php (0 => 143931)


--- trunk/LayoutTests/http/tests/cookies/resources/set-cookie-on-redirect.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/resources/set-cookie-on-redirect.php	2013-02-25 16:56:14 UTC (rev 143931)
@@ -0,0 +1,18 @@
+<?php
+if ($_GET['step'] == 1) {
+  header("HTTP/1.0 302 Found");
+  header('Location: http://localhost:8000/cookies/resources/set-cookie-on-redirect.php?step=2');
+} else if ($_GET['step'] == 2) {
+  header("HTTP/1.0 302 Found");
+  setcookie("test_cookie", "1");
+  header('Location: http://localhost:8000/cookies/resources/set-cookie-on-redirect.php?step=3');
+} else if ($_GET['step'] == 3) {
+  header("HTTP/1.0 200 OK");
+  if (isset($_COOKIE['test_cookie'])) {
+    echo "PASSED: Cookie successfully set\n";
+  } else {
+    echo "FAILED: Cookie not set\n";
+  }
+  echo "<script> if (window.testRunner) testRunner.notifyDone();</script>\n";
+}
+?>

Added: trunk/LayoutTests/http/tests/cookies/set-cookie-on-redirect-expected.txt (0 => 143931)


--- trunk/LayoutTests/http/tests/cookies/set-cookie-on-redirect-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/set-cookie-on-redirect-expected.txt	2013-02-25 16:56:14 UTC (rev 143931)
@@ -0,0 +1 @@
+PASSED: Cookie successfully set

Added: trunk/LayoutTests/http/tests/cookies/set-cookie-on-redirect.html (0 => 143931)


--- trunk/LayoutTests/http/tests/cookies/set-cookie-on-redirect.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/set-cookie-on-redirect.html	2013-02-25 16:56:14 UTC (rev 143931)
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function doRedirect()
+{
+  window.location = "http://127.0.0.1:8000/cookies/resources/set-cookie-on-redirect.php?step=1";
+}
+</script>
+
+<body _onload_="doRedirect()">
+<!-- Test for https://bugs.webkit.org/show_bug.cgi?id=64575 -->
+<!-- For this test to pass you should see "PASSED: Cookie successfully set" -->
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (143930 => 143931)


--- trunk/Source/WebCore/ChangeLog	2013-02-25 16:52:38 UTC (rev 143930)
+++ trunk/Source/WebCore/ChangeLog	2013-02-25 16:56:14 UTC (rev 143931)
@@ -1,3 +1,18 @@
+2013-02-25  Sergio Villar Senin  <svil...@igalia.com>
+
+        [soup] "Too many redirects" error loading chat in plus.google.com
+        https://bugs.webkit.org/show_bug.cgi?id=64575
+
+        Reviewed by Martin Robinson.
+
+        Set the firstPartyForCookies for the new request on redirects to
+        the URL used for redirection.
+
+        Test: http/tests/cookies/set-cookie-on-redirect.html
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::doRedirect):
+
 2013-02-25  Andreas Kling  <akl...@apple.com>
 
         Reduce amount of code that includes StylePropertySet.h

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (143930 => 143931)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2013-02-25 16:52:38 UTC (rev 143930)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2013-02-25 16:56:14 UTC (rev 143931)
@@ -459,6 +459,7 @@
     KURL newURL = KURL(soupURIToKURL(soup_message_get_uri(message)), location);
     bool crossOrigin = !protocolHostAndPortAreEqual(handle->firstRequest().url(), newURL);
     newRequest.setURL(newURL);
+    newRequest.setFirstPartyForCookies(newURL);
 
     if (newRequest.httpMethod() != "GET") {
         // Change newRequest method to GET if change was made during a previous redirection
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to