Title: [238891] trunk
Revision
238891
Author
[email protected]
Date
2018-12-05 03:10:56 -0800 (Wed, 05 Dec 2018)

Log Message

[Mac] HEAD requests changed to GET after 301, 302, and 303 redirections (http/tests/xmlhttprequest/head-redirection.html)
https://bugs.webkit.org/show_bug.cgi?id=114965

Patch by Rob Buis <[email protected]> on 2018-12-05
Reviewed by Frédéric Wang.

LayoutTests/imported/w3c:

Update test expectations.

* web-platform-tests/fetch/api/redirect/redirect-method-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt:

Source/WebCore:

HEAD requests should not be changed to GET after 303 redirects, see [1].
This was fixed earlier for GTK [2].

Behavior matches Firefox and Chrome.

[1] http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#section-7.4
[2] https://bugs.webkit.org/show_bug.cgi?id=110127

Tests: web-platform-tests/fetch/api/redirect/redirect-method.html
       web-platform-tests/fetch/api/redirect/redirect-method-worker.html
       http/tests/xmlhttprequest/head-redirection.html

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::willSendRequest):

Source/WebKit:

HEAD requests should not be changed to GET after 303 redirects, see [1].
This was fixed earlier for GTK [2].

Behavior matches Firefox and Chrome.

[1] http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#section-7.4
[2] https://bugs.webkit.org/show_bug.cgi?id=110127

Tests: web-platform-tests/fetch/api/redirect/redirect-method.html
       web-platform-tests/fetch/api/redirect/redirect-method-worker.html
       http/tests/xmlhttprequest/head-redirection.html

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

LayoutTests:

Update these since we now expect to pass head-redirection.html here.

* platform/ios/TestExpectations:
* platform/mac/http/tests/xmlhttprequest/head-redirection-expected.txt: Removed.

Modified Paths

Removed Paths

  • trunk/LayoutTests/platform/mac/http/tests/xmlhttprequest/

Diff

Modified: trunk/LayoutTests/ChangeLog (238890 => 238891)


--- trunk/LayoutTests/ChangeLog	2018-12-05 09:26:27 UTC (rev 238890)
+++ trunk/LayoutTests/ChangeLog	2018-12-05 11:10:56 UTC (rev 238891)
@@ -1,3 +1,15 @@
+2018-12-05  Rob Buis  <[email protected]>
+
+        [Mac] HEAD requests changed to GET after 301, 302, and 303 redirections (http/tests/xmlhttprequest/head-redirection.html)
+        https://bugs.webkit.org/show_bug.cgi?id=114965
+
+        Reviewed by Frédéric Wang.
+
+        Update these since we now expect to pass head-redirection.html here.
+
+        * platform/ios/TestExpectations:
+        * platform/mac/http/tests/xmlhttprequest/head-redirection-expected.txt: Removed.
+
 2018-12-05  Javier Fernandez  <[email protected]>
 
         [css-grid] Crash on debug changing the style of a positioned element

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (238890 => 238891)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-12-05 09:26:27 UTC (rev 238890)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-12-05 11:10:56 UTC (rev 238891)
@@ -1,5 +1,17 @@
 2018-12-05  Rob Buis  <[email protected]>
 
+        [Mac] HEAD requests changed to GET after 301, 302, and 303 redirections (http/tests/xmlhttprequest/head-redirection.html)
+        https://bugs.webkit.org/show_bug.cgi?id=114965
+
+        Reviewed by Frédéric Wang.
+
+        Update test expectations.
+
+        * web-platform-tests/fetch/api/redirect/redirect-method-expected.txt:
+        * web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt:
+
+2018-12-05  Rob Buis  <[email protected]>
+
         Align with Fetch on data: URLs
         https://bugs.webkit.org/show_bug.cgi?id=182325
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt (238890 => 238891)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt	2018-12-05 09:26:27 UTC (rev 238890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt	2018-12-05 11:10:56 UTC (rev 238891)
@@ -8,7 +8,7 @@
 PASS Redirect 302 with HEAD 
 PASS Redirect 303 with GET 
 PASS Redirect 303 with POST 
-FAIL Redirect 303 with HEAD assert_equals: Request method after redirection is HEAD expected "HEAD" but got "GET"
+PASS Redirect 303 with HEAD 
 PASS Redirect 307 with GET 
 PASS Redirect 307 with POST (string body) 
 PASS Redirect 307 with POST (blob body) 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt (238890 => 238891)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt	2018-12-05 09:26:27 UTC (rev 238890)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-worker-expected.txt	2018-12-05 11:10:56 UTC (rev 238891)
@@ -8,7 +8,7 @@
 PASS Redirect 302 with HEAD 
 PASS Redirect 303 with GET 
 PASS Redirect 303 with POST 
-FAIL Redirect 303 with HEAD assert_equals: Request method after redirection is HEAD expected "HEAD" but got "GET"
+PASS Redirect 303 with HEAD 
 PASS Redirect 307 with GET 
 PASS Redirect 307 with POST (string body) 
 PASS Redirect 307 with POST (blob body) 

Modified: trunk/LayoutTests/platform/ios/TestExpectations (238890 => 238891)


--- trunk/LayoutTests/platform/ios/TestExpectations	2018-12-05 09:26:27 UTC (rev 238890)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2018-12-05 11:10:56 UTC (rev 238891)
@@ -1551,7 +1551,6 @@
 # XMLHttpRequest tests that fail:
 http/tests/xmlhttprequest/basic-auth-nopassword.html [ Failure ]
 http/tests/xmlhttprequest/default-content-type-dashboard.html [ Failure ]
-http/tests/xmlhttprequest/head-redirection.html [ Failure ]
 
 # DeviceMotion tests that time out:
 fast/dom/DeviceMotion/no-page-cache.html

Modified: trunk/Source/WebCore/ChangeLog (238890 => 238891)


--- trunk/Source/WebCore/ChangeLog	2018-12-05 09:26:27 UTC (rev 238890)
+++ trunk/Source/WebCore/ChangeLog	2018-12-05 11:10:56 UTC (rev 238891)
@@ -1,5 +1,27 @@
 2018-12-05  Rob Buis  <[email protected]>
 
+        [Mac] HEAD requests changed to GET after 301, 302, and 303 redirections (http/tests/xmlhttprequest/head-redirection.html)
+        https://bugs.webkit.org/show_bug.cgi?id=114965
+
+        Reviewed by Frédéric Wang.
+
+        HEAD requests should not be changed to GET after 303 redirects, see [1].
+        This was fixed earlier for GTK [2].
+
+        Behavior matches Firefox and Chrome.
+
+        [1] http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#section-7.4
+        [2] https://bugs.webkit.org/show_bug.cgi?id=110127
+
+        Tests: web-platform-tests/fetch/api/redirect/redirect-method.html
+               web-platform-tests/fetch/api/redirect/redirect-method-worker.html
+               http/tests/xmlhttprequest/head-redirection.html
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::willSendRequest):
+
+2018-12-05  Rob Buis  <[email protected]>
+
         Align with Fetch on data: URLs
         https://bugs.webkit.org/show_bug.cgi?id=182325
 

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (238890 => 238891)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2018-12-05 09:26:27 UTC (rev 238890)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2018-12-05 11:10:56 UTC (rev 238891)
@@ -427,7 +427,8 @@
             if (!originalContentType.isEmpty())
                 request.setHTTPHeaderField(HTTPHeaderName::ContentType, originalContentType);
         }
-    }
+    } else if (redirectResponse.httpStatusCode() == 303 && equalLettersIgnoringASCIICase(d->m_firstRequest.httpMethod(), "head")) // FIXME: (rdar://problem/13706454).
+        request.setHTTPMethod("HEAD"_s);
 
     // Should not set Referer after a redirect from a secure resource to non-secure one.
     if (!request.url().protocolIs("https") && protocolIs(request.httpReferrer(), "https") && d->m_context->shouldClearReferrerOnHTTPSToHTTPRedirect())

Modified: trunk/Source/WebKit/ChangeLog (238890 => 238891)


--- trunk/Source/WebKit/ChangeLog	2018-12-05 09:26:27 UTC (rev 238890)
+++ trunk/Source/WebKit/ChangeLog	2018-12-05 11:10:56 UTC (rev 238891)
@@ -1,3 +1,25 @@
+2018-12-05  Rob Buis  <[email protected]>
+
+        [Mac] HEAD requests changed to GET after 301, 302, and 303 redirections (http/tests/xmlhttprequest/head-redirection.html)
+        https://bugs.webkit.org/show_bug.cgi?id=114965
+
+        Reviewed by Frédéric Wang.
+
+        HEAD requests should not be changed to GET after 303 redirects, see [1].
+        This was fixed earlier for GTK [2].
+
+        Behavior matches Firefox and Chrome.
+
+        [1] http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#section-7.4
+        [2] https://bugs.webkit.org/show_bug.cgi?id=110127
+
+        Tests: web-platform-tests/fetch/api/redirect/redirect-method.html
+               web-platform-tests/fetch/api/redirect/redirect-method-worker.html
+               http/tests/xmlhttprequest/head-redirection.html
+
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
+
 2018-12-04  Fujii Hironori  <[email protected]>
 
         Remove using namespace WebCore and WebKit under WebKit/Shared/API

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (238890 => 238891)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-12-05 09:26:27 UTC (rev 238890)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2018-12-05 11:10:56 UTC (rev 238891)
@@ -307,7 +307,8 @@
         String originalContentType = m_firstRequest.httpContentType();
         if (!originalContentType.isEmpty())
             request.setHTTPHeaderField(WebCore::HTTPHeaderName::ContentType, originalContentType);
-    }
+    } else if (redirectResponse.httpStatusCode() == 303 && equalLettersIgnoringASCIICase(m_firstRequest.httpMethod(), "head")) // FIXME: (rdar://problem/13706454).
+        request.setHTTPMethod("HEAD"_s);
     
     // Should not set Referer after a redirect from a secure resource to non-secure one.
     if (m_shouldClearReferrerOnHTTPSToHTTPRedirect && !request.url().protocolIs("https") && WTF::protocolIs(request.httpReferrer(), "https"))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to