Title: [183508] branches/safari-600.7-branch

Diff

Modified: branches/safari-600.7-branch/LayoutTests/ChangeLog (183507 => 183508)


--- branches/safari-600.7-branch/LayoutTests/ChangeLog	2015-04-28 20:45:24 UTC (rev 183507)
+++ branches/safari-600.7-branch/LayoutTests/ChangeLog	2015-04-28 21:19:15 UTC (rev 183508)
@@ -1,3 +1,24 @@
+2015-04-28  Matthew Hanson  <[email protected]>
+
+        Merge r183280. rdar://problem/20694404
+
+    2015-04-24  Brady Eidson  <[email protected]>
+
+            Origin header is preserved on cross-origin redirects.
+            https://bugs.webkit.org/show_bug.cgi?id=144157.
+
+            Reviewed by Sam Weinig.
+
+            * http/tests/security/cors-post-redirect-301-expected.txt: Added.
+            * http/tests/security/cors-post-redirect-301.html: Added.
+            * http/tests/security/cors-post-redirect-302-expected.txt: Added.
+            * http/tests/security/cors-post-redirect-302.html: Added.
+            * http/tests/security/cors-post-redirect-307-expected.txt: Added.
+            * http/tests/security/cors-post-redirect-307.html: Added.
+            * http/tests/security/cors-post-redirect-308-expected.txt: Added.
+            * http/tests/security/cors-post-redirect-308.html: Added.
+            * http/tests/security/resources/cors-post-redirect-target.php: Added.
+
 2015-04-23  Babak Shafiei  <[email protected]>
 
         Merge r181656 & r182985.

Added: branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt (0 => 183508)


--- branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt	                        (rev 0)
+++ branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt	2015-04-28 21:19:15 UTC (rev 183508)
@@ -0,0 +1 @@
+There was no origin header

Added: branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-301.html (0 => 183508)


--- branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-301.html	                        (rev 0)
+++ branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-301.html	2015-04-28 21:19:15 UTC (rev 183508)
@@ -0,0 +1,24 @@
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+</script>
+</head>
+<body>
+
+This test is designed to work only when loaded from http://127.0.0.1:8000
+
+<form id='testForm' method='POST'>
+<input id='redircode' type='hidden' name='redircode' value='301'>
+</form>
+
+<script>
+
+var form = document.getElementById('testForm');
+form.action = ""
+form.submit();
+ 
+</script>
+</body>

Added: branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt (0 => 183508)


--- branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt	                        (rev 0)
+++ branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt	2015-04-28 21:19:15 UTC (rev 183508)
@@ -0,0 +1 @@
+There was no origin header

Added: branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-302.html (0 => 183508)


--- branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-302.html	                        (rev 0)
+++ branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-302.html	2015-04-28 21:19:15 UTC (rev 183508)
@@ -0,0 +1,24 @@
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+</script>
+</head>
+<body>
+
+This test is designed to work only when loaded from http://127.0.0.1:8000
+
+<form id='testForm' method='POST'>
+<input id='redircode' type='hidden' name='redircode' value='302'>
+</form>
+
+<script>
+
+var form = document.getElementById('testForm');
+form.action = ""
+form.submit();
+ 
+</script>
+</body>

Added: branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt (0 => 183508)


--- branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt	                        (rev 0)
+++ branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt	2015-04-28 21:19:15 UTC (rev 183508)
@@ -0,0 +1 @@
+There was no origin header

Added: branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-307.html (0 => 183508)


--- branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-307.html	                        (rev 0)
+++ branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-307.html	2015-04-28 21:19:15 UTC (rev 183508)
@@ -0,0 +1,24 @@
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+</script>
+</head>
+<body>
+
+This test is designed to work only when loaded from http://127.0.0.1:8000
+
+<form id='testForm' method='POST'>
+<input id='redircode' type='hidden' name='redircode' value='307'>
+</form>
+
+<script>
+
+var form = document.getElementById('testForm');
+form.action = ""
+form.submit();
+ 
+</script>
+</body>

Added: branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt (0 => 183508)


--- branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt	                        (rev 0)
+++ branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt	2015-04-28 21:19:15 UTC (rev 183508)
@@ -0,0 +1 @@
+There was no origin header

Added: branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-308.html (0 => 183508)


--- branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-308.html	                        (rev 0)
+++ branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-308.html	2015-04-28 21:19:15 UTC (rev 183508)
@@ -0,0 +1,24 @@
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+</script>
+</head>
+<body>
+
+This test is designed to work only when loaded from http://127.0.0.1:8000
+
+<form id='testForm' method='POST'>
+<input id='redircode' type='hidden' name='redircode' value='308'>
+</form>
+
+<script>
+
+var form = document.getElementById('testForm');
+form.action = ""
+form.submit();
+ 
+</script>
+</body>

Added: branches/safari-600.7-branch/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php (0 => 183508)


--- branches/safari-600.7-branch/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php	                        (rev 0)
+++ branches/safari-600.7-branch/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php	2015-04-28 21:19:15 UTC (rev 183508)
@@ -0,0 +1,17 @@
+<?php
+$sawOrigin = false;
+foreach (getallheaders() as $name => $value) {
+    if (strtolower($name) == "origin") {
+        echo "Origin header value: $value";
+        $sawOrigin = true;
+    }
+}
+
+if (!$sawOrigin)
+    echo "There was no origin header";
+
+?>
+<script>
+if (window.testRunner)
+    testRunner.notifyDone();
+</script>

Modified: branches/safari-600.7-branch/Source/WebCore/ChangeLog (183507 => 183508)


--- branches/safari-600.7-branch/Source/WebCore/ChangeLog	2015-04-28 20:45:24 UTC (rev 183507)
+++ branches/safari-600.7-branch/Source/WebCore/ChangeLog	2015-04-28 21:19:15 UTC (rev 183508)
@@ -1,3 +1,24 @@
+2015-04-28  Matthew Hanson  <[email protected]>
+
+        Merge r183280. rdar://problem/20694404
+
+    2015-04-24  Brady Eidson  <[email protected]>
+
+            Origin header is preserved on cross-origin redirects.
+            https://bugs.webkit.org/show_bug.cgi?id=144157.
+
+            Reviewed by Sam Weinig.
+
+            Tests: http/tests/security/cors-post-redirect-301.html
+                   http/tests/security/cors-post-redirect-302.html
+                   http/tests/security/cors-post-redirect-307.html
+                   http/tests/security/cors-post-redirect-308.html
+
+            * platform/network/cf/ResourceHandleCFNet.cpp:
+            (WebCore::ResourceHandle::willSendRequest): Always clear any origin header for cross-origin redirects.
+            * platform/network/mac/ResourceHandleMac.mm:
+            (WebCore::ResourceHandle::willSendRequest): Ditto.
+
 2015-04-23  Babak Shafiei  <[email protected]>
 
         Merge r181656 and r182985.

Modified: branches/safari-600.7-branch/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (183507 => 183508)


--- branches/safari-600.7-branch/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2015-04-28 20:45:24 UTC (rev 183507)
+++ branches/safari-600.7-branch/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2015-04-28 21:19:15 UTC (rev 183508)
@@ -280,9 +280,10 @@
     request.removeCredentials();
 
     if (!protocolHostAndPortAreEqual(request.url(), redirectResponse.url())) {
-        // If the network layer carries over authentication headers from the original request
-        // in a cross-origin redirect, we want to clear those headers here.
+        // The network layer might carry over some headers from the original request that
+        // we want to strip here because the redirect is cross-origin.
         request.clearHTTPAuthorization();
+        request.clearHTTPOrigin();
     } else {
         // Only consider applying authentication credentials if this is actually a redirect and the redirect
         // URL didn't include credentials of its own.

Modified: branches/safari-600.7-branch/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (183507 => 183508)


--- branches/safari-600.7-branch/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-04-28 20:45:24 UTC (rev 183507)
+++ branches/safari-600.7-branch/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2015-04-28 21:19:15 UTC (rev 183508)
@@ -471,10 +471,10 @@
     request.removeCredentials();
 
     if (!protocolHostAndPortAreEqual(request.url(), redirectResponse.url())) {
-        // If the network layer carries over authentication headers from the original request
-        // in a cross-origin redirect, we want to clear those headers here.
-        // As of Lion, CFNetwork no longer does this.
+        // The network layer might carry over some headers from the original request that
+        // we want to strip here because the redirect is cross-origin.
         request.clearHTTPAuthorization();
+        request.clearHTTPOrigin();
     } else {
         // Only consider applying authentication credentials if this is actually a redirect and the redirect
         // URL didn't include credentials of its own.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to