[webkit-changes] [WebKit/WebKit] 9b8c53: Content-Type gets wrongfully added to GET request ...

Matthew Finkel noreply at github.com
Thu Aug 10 07:13:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9b8c53bed4f5ca3e81bc07fa1aed2b0d9dd6ae1a
      https://github.com/WebKit/WebKit/commit/9b8c53bed4f5ca3e81bc07fa1aed2b0d9dd6ae1a
  Author: Matthew Finkel <sysrqb at apple.com>
  Date:   2023-08-10 (Thu, 10 Aug 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/xhr/resources/redirect.py
    M LayoutTests/imported/w3c/web-platform-tests/xhr/send-redirect-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/xhr/send-redirect.htm
    M Source/WebCore/platform/network/ResourceHandleInternal.h
    M Source/WebCore/platform/network/mac/ResourceHandleMac.mm
    M Source/WebKit/NetworkProcess/NetworkDataTask.h
    M Source/WebKit/NetworkProcess/NetworkLoad.h
    M Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm

  Log Message:
  -----------
  Content-Type gets wrongfully added to GET request after 303 redirects
https://bugs.webkit.org/show_bug.cgi?id=258720
rdar://111899420

Reviewed by Chris Dumez.

In 252713 at main we began copying the Content-Type header from the original
request if we receive a redirect with a 303 response status. However, we may be
handling a subsequent redirect, and in some cases the Content-Type header is
removed from redirect requests. For example, if we transition from a POST to a
GET request, Fetch 4.4.12 [0] says that the Content-Type header should be
deleted. WebKit currently follows this specification, but we re-introduce the
header on a second redirect because we consult the first request instead of the
previous request.

This patch introduces NetworkDataTask::m_previousRequest to keep track of the
previous request. This is duplicate information that is stored in NetworkLoad,
as well, but I'm leaving merging these two copies for a follow-up patch.

[0] https://fetch.spec.whatwg.org/#http-redirect-fetch

* LayoutTests/imported/w3c/web-platform-tests/xhr/resources/redirect.py:
(main):
* LayoutTests/imported/w3c/web-platform-tests/xhr/send-redirect-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/xhr/send-redirect.htm:
* Source/WebCore/platform/network/ResourceHandleInternal.h:
* Source/WebCore/platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::willSendRequest):
* Source/WebKit/NetworkProcess/NetworkDataTask.h:
* Source/WebKit/NetworkProcess/NetworkLoad.h:
* Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
(TEST):

Canonical link: https://commits.webkit.org/266761@main




More information about the webkit-changes mailing list