Skip to content

Commit

Permalink
[Curl] Discard response headers when an error occurs
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=247716

Reviewed by Fujii Hironori.

If a cURL error occurs before the response body is received,
the previously received response headers are not notified to WebCore
to avoid malfunction.

* Source/WebCore/platform/network/curl/CurlRequest.cpp:
(WebCore::CurlRequest::didReceiveHeader):
(WebCore::CurlRequest::didCompleteTransfer):
(WebCore::CurlRequest::shouldAbortConnectRequest): Deleted.
* Source/WebCore/platform/network/curl/CurlRequest.h:

Canonical link: https://commits.webkit.org/256639@main
  • Loading branch information
kshukuwa authored and fujii committed Nov 14, 2022
1 parent 48b4b16 commit c9f5e13
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Source/WebCore/platform/network/curl/CurlRequest.cpp
Expand Up @@ -466,16 +466,16 @@ void CurlRequest::didCompleteTransfer(CURLcode result)
return;
}

if (needToInvokeDidReceiveResponse()) {
// Processing of didReceiveResponse() has not been completed. (For example, HEAD method)
// When completeDidReceiveResponse() is called, didCompleteTransfer() will be called again.
if (result == CURLE_OK) {
if (needToInvokeDidReceiveResponse()) {
// Processing of didReceiveResponse() has not been completed. (For example, HEAD method)
// When completeDidReceiveResponse() is called, didCompleteTransfer() will be called again.

m_finishedResultCode = result;
invokeDidReceiveResponse(m_response, Action::FinishTransfer);
return;
}
m_finishedResultCode = result;
invokeDidReceiveResponse(m_response, Action::FinishTransfer);
return;
}

if (result == CURLE_OK) {
if (m_multipartHandle)
m_multipartHandle->didComplete();

Expand Down

0 comments on commit c9f5e13

Please sign in to comment.