Title: [196707] trunk
Revision
196707
Author
achristen...@apple.com
Date
2016-02-17 12:11:05 -0800 (Wed, 17 Feb 2016)

Log Message

Copy http body when being redirected with 308 with NetworkSession
https://bugs.webkit.org/show_bug.cgi?id=154348

Reviewed by Brady Eidson.
Source/WebKit2:

        
This fixes http/tests/security/cors-post-redirect-308.html
which used to assert in ResourceRequest::doUpdateResourceHTTPBody

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTask::willPerformHTTPRedirection):

LayoutTests:


* http/tests/navigation/post-308-response-expected.txt: Copied from LayoutTests/http/tests/navigation/post-307-response-expected.txt.
* http/tests/navigation/post-308-response.html: Copied from LayoutTests/http/tests/navigation/post-307-response.html.
* http/tests/navigation/resources/redirection-response.php:
Added a test verifying data is being sent with post requests after being redirected with an http status code of 308.
We already had non-CORS tests for 301, 302, 303, and 307, and we already had CORS tests for 301, 302, 303, 307, and 308.
This fills in the missing non-CORS test.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (196706 => 196707)


--- trunk/LayoutTests/ChangeLog	2016-02-17 19:31:10 UTC (rev 196706)
+++ trunk/LayoutTests/ChangeLog	2016-02-17 20:11:05 UTC (rev 196707)
@@ -1,3 +1,17 @@
+2016-02-17  Alex Christensen  <achristen...@webkit.org>
+
+        Copy http body when being redirected with 308 with NetworkSession
+        https://bugs.webkit.org/show_bug.cgi?id=154348
+
+        Reviewed by Brady Eidson.
+
+        * http/tests/navigation/post-308-response-expected.txt: Copied from LayoutTests/http/tests/navigation/post-307-response-expected.txt.
+        * http/tests/navigation/post-308-response.html: Copied from LayoutTests/http/tests/navigation/post-307-response.html.
+        * http/tests/navigation/resources/redirection-response.php:
+        Added a test verifying data is being sent with post requests after being redirected with an http status code of 308.
+        We already had non-CORS tests for 301, 302, 303, and 307, and we already had CORS tests for 301, 302, 303, 307, and 308.
+        This fills in the missing non-CORS test.
+
 2016-02-17  Chris Dumez  <cdu...@apple.com>
 
         Regression(r196648): window.showModalDialog is no longer undefined if the client does not allow showing modal dialog

Copied: trunk/LayoutTests/http/tests/navigation/post-308-response-expected.txt (from rev 196672, trunk/LayoutTests/http/tests/navigation/post-307-response-expected.txt) (0 => 196707)


--- trunk/LayoutTests/http/tests/navigation/post-308-response-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/post-308-response-expected.txt	2016-02-17 20:11:05 UTC (rev 196707)
@@ -0,0 +1,7 @@
+headers CONTENT_TYPE and CONTENT_LENGTH should be present.
+CONTENT_TYPE is present. Its value is: application/x-www-form-urlencoded
+CONTENT_LENGTH is present. Its value is: 15
+
+POST data should be present.
+POST data is present.
+

Copied: trunk/LayoutTests/http/tests/navigation/post-308-response.html (from rev 196672, trunk/LayoutTests/http/tests/navigation/post-307-response.html) (0 => 196707)


--- trunk/LayoutTests/http/tests/navigation/post-308-response.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/post-308-response.html	2016-02-17 20:11:05 UTC (rev 196707)
@@ -0,0 +1,18 @@
+<html>
+<head>
+<script>
+var doTest = function () {
+    if (window.testRunner) {
+        window.testRunner.dumpAsText();
+        window.testRunner.waitUntilDone();
+    }
+    document.getElementById("form1").submit();
+};
+</script>
+</head>
+<body _onload_="doTest()">
+<form id="form1" action="" method="post">
+<input type="text" name="text1" value="some text"><br>
+</form>
+</body>
+</html>

Modified: trunk/LayoutTests/http/tests/navigation/resources/redirection-response.php (196706 => 196707)


--- trunk/LayoutTests/http/tests/navigation/resources/redirection-response.php	2016-02-17 19:31:10 UTC (rev 196706)
+++ trunk/LayoutTests/http/tests/navigation/resources/redirection-response.php	2016-02-17 20:11:05 UTC (rev 196707)
@@ -24,6 +24,10 @@
         header("HTTP/1.1 307 Temporary Redirect");
         header("Location: http://" . $host . $uri);
         break;
+    case 308:
+        header("HTTP/1.1 308 Permanent Redirect");
+        header("Location: http://" . $host . $uri);
+        break;
     default:
         header("HTTP/1.1 500 Internal Server Error");
         echo "Unexpected status code ($status_code) received.";

Modified: trunk/Source/WebKit2/ChangeLog (196706 => 196707)


--- trunk/Source/WebKit2/ChangeLog	2016-02-17 19:31:10 UTC (rev 196706)
+++ trunk/Source/WebKit2/ChangeLog	2016-02-17 20:11:05 UTC (rev 196707)
@@ -1,3 +1,16 @@
+2016-02-17  Alex Christensen  <achristen...@webkit.org>
+
+        Copy http body when being redirected with 308 with NetworkSession
+        https://bugs.webkit.org/show_bug.cgi?id=154348
+
+        Reviewed by Brady Eidson.
+        
+        This fixes http/tests/security/cors-post-redirect-308.html
+        which used to assert in ResourceRequest::doUpdateResourceHTTPBody
+
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTask::willPerformHTTPRedirection):
+
 2016-02-17  Brady Eidson  <beid...@apple.com>
 
         Modern IDB: More WK2 IPC Scaffolding.

Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (196706 => 196707)


--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2016-02-17 19:31:10 UTC (rev 196706)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2016-02-17 20:11:05 UTC (rev 196707)
@@ -88,7 +88,7 @@
 
 void NetworkDataTask::willPerformHTTPRedirection(const WebCore::ResourceResponse& redirectResponse, WebCore::ResourceRequest&& request, RedirectCompletionHandler completionHandler)
 {
-    if (redirectResponse.httpStatusCode() == 307) {
+    if (redirectResponse.httpStatusCode() == 307 || redirectResponse.httpStatusCode() == 308) {
         ASSERT(m_lastHTTPMethod == request.httpMethod());
         WebCore::FormData* body = m_firstRequest.httpBody();
         if (body && !body->isEmpty() && !equalLettersIgnoringASCIICase(m_lastHTTPMethod, "get"))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to