Changeset 251786 in webkit
- Timestamp:
- Oct 30, 2019 11:32:59 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r251780 r251786 1 2019-10-30 Chris Dumez <cdumez@apple.com> 2 3 REGRESSION (r238252): HTTP POST is losing application/x-www-form-urlencoded body if there's a redirect to different host 4 https://bugs.webkit.org/show_bug.cgi?id=201950 5 <rdar://problem/55577782> 6 7 Reviewed by Alex Christensen. 8 9 Add layout test coverage. 10 11 * http/tests/misc/form-submit-file-cross-site-redirect-expected.txt: Added. 12 * http/tests/misc/form-submit-file-cross-site-redirect.html: Added. 13 1 14 2019-10-30 Antti Koivisto <antti@apple.com> 2 15 -
trunk/LayoutTests/platform/win/TestExpectations
r251746 r251786 214 214 fast/forms/file/recover-file-input-in-unposted-form.html [ Skip ] 215 215 http/tests/misc/form-submit-file-cross-site.html [ Skip ] 216 http/tests/misc/form-submit-file-cross-site-redirect.html [ Skip ] 216 217 http/tests/xmlhttprequest/post-blob-content-type-async.html [ Skip ] 217 218 http/tests/xmlhttprequest/post-blob-content-type-sync.html [ Skip ] -
trunk/Source/WebKit/ChangeLog
r251784 r251786 1 2019-10-30 Chris Dumez <cdumez@apple.com> 2 3 REGRESSION (r238252): HTTP POST is losing application/x-www-form-urlencoded body if there's a redirect to different host 4 https://bugs.webkit.org/show_bug.cgi?id=201950 5 <rdar://problem/55577782> 6 7 Reviewed by Alex Christensen. 8 9 The resource request body was getting lost on cross-site redirects. This was caused by the fact that a cross-site 10 redirect would cause a process-swap and the request to start again from a new process. This would work fine if 11 the request does not have a body. However, we have an optimization in place which avoids encoding the request body 12 whenever it is sent over IPC. Because the WebResourceLoader::WillSendRequest IPC would not encode the request body, 13 any decision to process swap as a result of this IPC (i.e. redirect) would cause the new request in the new process 14 to be missing its body. To address the issue, we now make sure to pass the request body in the WillSendRequest IPC 15 and reconsile the request with its body on the recipient side. 16 17 Test: http/tests/misc/form-submit-file-cross-site-redirect.html 18 19 * NetworkProcess/NetworkResourceLoader.cpp: 20 (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest): 21 * NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp: 22 (WebKit::ServiceWorkerFetchTask::didReceiveRedirectResponse): 23 * WebProcess/Network/WebResourceLoader.cpp: 24 (WebKit::WebResourceLoader::willSendRequest): 25 * WebProcess/Network/WebResourceLoader.h: 26 * WebProcess/Network/WebResourceLoader.messages.in: 27 1 28 2019-10-30 Jer Noble <jer.noble@apple.com> 2 29 -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
r251710 r251786 724 724 networkSession->handleAdClickAttributionConversion(WTFMove(*adClickConversion), request.url(), redirectRequest); 725 725 726 send(Messages::WebResourceLoader::WillSendRequest(redirectRequest, sanitizeResponseIfPossible(WTFMove(redirectResponse), ResourceResponse::SanitizationType::Redirection))); 726 // We send the request body separately because the ResourceRequest body normally does not get encoded when sent over IPC, as an optimization. 727 // However, we really need the body here because a redirect cross-site may cause a process-swap and the request to start again in a new WebContent process. 728 send(Messages::WebResourceLoader::WillSendRequest(redirectRequest, IPC::FormDataReference { redirectRequest.httpBody() }, sanitizeResponseIfPossible(WTFMove(redirectResponse), ResourceResponse::SanitizationType::Redirection))); 727 729 } 728 730 -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp
r251434 r251786 112 112 auto newRequest = m_currentRequest.redirectedRequest(response, m_loader.parameters().shouldClearReferrerOnHTTPSToHTTPRedirect); 113 113 114 sendToClient(Messages::WebResourceLoader::WillSendRequest { newRequest, response });114 sendToClient(Messages::WebResourceLoader::WillSendRequest { newRequest, IPC::FormDataReference { newRequest.httpBody() }, response }); 115 115 } 116 116 -
trunk/Source/WebKit/WebProcess/Network/WebResourceLoader.cpp
r251585 r251786 28 28 29 29 #include "DataReference.h" 30 #include "FormDataReference.h" 30 31 #include "Logging.h" 31 32 #include "NetworkProcessConnection.h" … … 93 94 } 94 95 95 void WebResourceLoader::willSendRequest(ResourceRequest&& proposedRequest, ResourceResponse&& redirectResponse)96 void WebResourceLoader::willSendRequest(ResourceRequest&& proposedRequest, IPC::FormDataReference&& proposedRequestBody, ResourceResponse&& redirectResponse) 96 97 { 97 98 Ref<WebResourceLoader> protectedThis(*this); 99 100 // Make the request whole again as we do not normally encode the request's body when sending it over IPC, for performance reasons. 101 proposedRequest.setHTTPBody(proposedRequestBody.takeData()); 98 102 99 103 LOG(Network, "(WebProcess) WebResourceLoader::willSendRequest to '%s'", proposedRequest.url().string().latin1().data()); -
trunk/Source/WebKit/WebProcess/Network/WebResourceLoader.h
r251124 r251786 38 38 namespace IPC { 39 39 class DataReference; 40 class FormDataReference; 40 41 } 41 42 … … 80 81 uint64_t messageSenderDestinationID() const override; 81 82 82 void willSendRequest(WebCore::ResourceRequest&&, WebCore::ResourceResponse&&);83 void willSendRequest(WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody, WebCore::ResourceResponse&&); 83 84 void didSendData(uint64_t bytesSent, uint64_t totalBytesToBeSent); 84 85 void didReceiveResponse(const WebCore::ResourceResponse&, bool needsContinueDidReceiveResponseMessage); -
trunk/Source/WebKit/WebProcess/Network/WebResourceLoader.messages.in
r251124 r251786 22 22 23 23 messages -> WebResourceLoader LegacyReceiver { 24 WillSendRequest(WebCore::ResourceRequest request, WebCore::ResourceResponse redirectResponse)24 WillSendRequest(WebCore::ResourceRequest request, IPC::FormDataReference requestBody, WebCore::ResourceResponse redirectResponse) 25 25 DidSendData(uint64_t bytesSent, uint64_t totalBytesToBeSent) 26 26 DidReceiveResponse(WebCore::ResourceResponse response, bool needsContinueDidReceiveResponseMessage)
Note: See TracChangeset
for help on using the changeset viewer.