Diff
Modified: branches/safari-600.1.4.16-branch/LayoutTests/ChangeLog (183518 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/ChangeLog 2015-04-29 00:22:33 UTC (rev 183518)
+++ branches/safari-600.1.4.16-branch/LayoutTests/ChangeLog 2015-04-29 00:32:25 UTC (rev 183519)
@@ -1,3 +1,24 @@
+2015-04-28 Babak Shafiei <[email protected]>
+
+ Merge r183280.
+
+ 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-21 Lucas Forschler <[email protected]>
Merge r180110
Copied: branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt (from rev 183508, branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt) (0 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt (rev 0)
+++ branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-301-expected.txt 2015-04-29 00:32:25 UTC (rev 183519)
@@ -0,0 +1 @@
+There was no origin header
Copied: branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-301.html (from rev 183508, branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-301.html) (0 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-301.html (rev 0)
+++ branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-301.html 2015-04-29 00:32:25 UTC (rev 183519)
@@ -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>
Copied: branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt (from rev 183508, branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt) (0 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt (rev 0)
+++ branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-302-expected.txt 2015-04-29 00:32:25 UTC (rev 183519)
@@ -0,0 +1 @@
+There was no origin header
Copied: branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-302.html (from rev 183508, branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-302.html) (0 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-302.html (rev 0)
+++ branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-302.html 2015-04-29 00:32:25 UTC (rev 183519)
@@ -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>
Copied: branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt (from rev 183508, branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt) (0 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt (rev 0)
+++ branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-307-expected.txt 2015-04-29 00:32:25 UTC (rev 183519)
@@ -0,0 +1 @@
+There was no origin header
Copied: branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-307.html (from rev 183508, branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-307.html) (0 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-307.html (rev 0)
+++ branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-307.html 2015-04-29 00:32:25 UTC (rev 183519)
@@ -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>
Copied: branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt (from rev 183508, branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt) (0 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt (rev 0)
+++ branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-308-expected.txt 2015-04-29 00:32:25 UTC (rev 183519)
@@ -0,0 +1 @@
+There was no origin header
Copied: branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-308.html (from rev 183508, branches/safari-600.7-branch/LayoutTests/http/tests/security/cors-post-redirect-308.html) (0 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-308.html (rev 0)
+++ branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/cors-post-redirect-308.html 2015-04-29 00:32:25 UTC (rev 183519)
@@ -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>
Copied: branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php (from rev 183508, branches/safari-600.7-branch/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php) (0 => 183519)
--- branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php (rev 0)
+++ branches/safari-600.1.4.16-branch/LayoutTests/http/tests/security/resources/cors-post-redirect-target.php 2015-04-29 00:32:25 UTC (rev 183519)
@@ -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.1.4.16-branch/Source/WebCore/ChangeLog (183518 => 183519)
--- branches/safari-600.1.4.16-branch/Source/WebCore/ChangeLog 2015-04-29 00:22:33 UTC (rev 183518)
+++ branches/safari-600.1.4.16-branch/Source/WebCore/ChangeLog 2015-04-29 00:32:25 UTC (rev 183519)
@@ -1,3 +1,24 @@
+2015-04-28 Babak Shafiei <[email protected]>
+
+ Merge r183280.
+
+ 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-21 Lucas Forschler <[email protected]>
Merge r180110
Modified: branches/safari-600.1.4.16-branch/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (183518 => 183519)
--- branches/safari-600.1.4.16-branch/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2015-04-29 00:22:33 UTC (rev 183518)
+++ branches/safari-600.1.4.16-branch/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2015-04-29 00:32:25 UTC (rev 183519)
@@ -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.1.4.16-branch/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (183518 => 183519)
--- branches/safari-600.1.4.16-branch/Source/WebCore/platform/network/mac/ResourceHandleMac.mm 2015-04-29 00:22:33 UTC (rev 183518)
+++ branches/safari-600.1.4.16-branch/Source/WebCore/platform/network/mac/ResourceHandleMac.mm 2015-04-29 00:32:25 UTC (rev 183519)
@@ -472,10 +472,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.