Bug 272445 - [Win] Some http tests are failing with libcurl 8.7.1
Summary: [Win] Some http tests are failing with libcurl 8.7.1
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: DoNotImportToRadar
Depends on:
Blocks:
 
Reported: 2024-04-10 00:10 PDT by Fujii Hironori
Modified: 2024-05-30 17:59 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2024-04-10 00:10:22 PDT
Some http tests are failing with WebKitRequirements v2024.04.03 on my PC.
However, the WinCairo buildbot doesn't fail.

WebKitRequirements v2024.04.03
https://github.com/WebKitForWindows/WebKitRequirements/releases/tag/v2024.04.03

> Library	Current	Previous
> c-ares	1.28.1	1.28.0
> curl	8.7.1	8.6.0

Regressions: Unexpected text-only failures (4)
  http/tests/inspector/network/resource-sizes-network.html [ Failure ]
  http/tests/xmlhttprequest/onabort-response-getters.html [ Failure ]
  http/tests/xmlhttprequest/onload-progressevent-attributes.html [ Failure ]
  http/tests/xmlhttprequest/xmlhttprequest-LSProgressEvent-ProgressEvent-should-match.html [ Failure ]
Comment 1 Fujii Hironori 2024-04-10 00:34:17 PDT
This problem can be worked around by copying libcurl.dll from WebKitRequirementsWin64.zip v2024.03.29.
Comment 2 Kenji Shukuwa 2024-04-15 02:05:37 PDT
The problem has been occurring since the following PR was merged.

https://github.com/curl/curl/pull/13134

In the current WebKit code, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T is retrieved when the header is received, but since the above commit, it returns -1, which causes the tests to fail.

https://github.com/WebKit/WebKit/blob/8d7eceb1f07dd13e4e2195f14d02fc27489a87a9/Source/WebCore/platform/network/curl/CurlRequest.cpp#L320-L321
---
size_t CurlRequest::didReceiveHeader(String&& header)
{
    ...


    if (auto length = m_curlHandle->getContentLength())
        m_response.expectedContentLength = *length;

    ...
}
---

https://github.com/WebKit/WebKit/blob/8d7eceb1f07dd13e4e2195f14d02fc27489a87a9/Source/WebCore/platform/network/curl/CurlContext.cpp#L731-L742
---
std::optional<long long> CurlHandle::getContentLength()
{
    if (!m_handle)
        return std::nullopt;

    curl_off_t contentLength;
    CURLcode errorCode = curl_easy_getinfo(m_handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &contentLength);
    if (errorCode != CURLE_OK)
        return std::nullopt;

    return contentLength;
}
---
Comment 3 Radar WebKit Bug Importer 2024-04-17 00:11:17 PDT
<rdar://problem/126606241>
Comment 4 Fujii Hironori 2024-04-18 05:10:13 PDT
(In reply to Fujii Hironori from comment #0)
> However, the WinCairo buildbot doesn't fail.

The reason why this problem isn't reproducible on the WinCairo buildbot is that it's failing to download the latest WebKitRequirements.

https://build.webkit.org/#/builders/727/builds/22385
> Seeking release "v2024.04.17" from WebKitForWindows/WebKitRequirements...
> <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)>
Comment 5 Kenji Shukuwa 2024-05-16 19:13:31 PDT
The cause of http/tests/inspector/network/resource-sizes-network.html was different from Comment 2.

The problem has been occurring since the following PR was merged.

https://github.com/curl/curl/pull/12964

This is due to CURLINFO_REQUEST_SIZE returning 0. Before the PR above, We were able to get CURLINFO_REQUEST_SIZE during the request header callback, but after the PR above, it returns 0, which causes the tests to fail.

https://github.com/WebKit/WebKit/blob/8d7eceb1f07dd13e4e2195f14d02fc27489a87a9/Source/WebCore/platform/network/curl/CurlContext.cpp#L889-L891
---
    CURLcode errorCode = curl_easy_getinfo(m_handle, CURLINFO_REQUEST_SIZE, &requestHeaderSize);
    if (errorCode != CURLE_OK)
        return;
---
Comment 6 Kenji Shukuwa 2024-05-16 20:53:14 PDT
Pull request: https://github.com/WebKit/WebKit/pull/28693
Comment 7 EWS 2024-05-30 17:59:16 PDT
Committed 279553@main (8a9f0f239bc4): <https://commits.webkit.org/279553@main>

Reviewed commits have been landed. Closing PR #28693 and removing active labels.