Repository navigation
Suppress HTTP cache upload response bodies - #2184
Open
Osyotr (Osyotr) wants to merge 2 commits into
Open
Osyotr (Osyotr) wants to merge 2 commits into
Osyotr (Osyotr) wants to merge 2 commits into
Conversation
Set a write callback in store_to_asset_cache() to discard response bodies instead of letting libcurl write them to stdout.
Copilot stopped reviewing on behalf of
Osyotr (Osyotr) due to an error
November 9, 2026 07:46
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Copilot review overview
3 open issues
SettingCURLOPT_WRITEFUNCTIONto always discard the response body can remove potentially useful… · New SettingCURLOPT_WRITEFUNCTIONto always discard the response body can remove potentially useful… · New The new callback is correct but the one-line definition makes it harder to notice why it exists.… · New
What changed in this PR
This PR changes the asset-cache upload path to explicitly discard the HTTP response body returned by libcurl during upload.
Changes:
- Add a
CURLOPT_WRITEFUNCTIONcallback that discards any received response bytes. - Attach that callback to the curl handle in
store_to_asset_cache().
| File | Description |
|---|---|
| src/vcpkg/base/downloads.cpp | Discards upload response bodies to avoid libcurl’s default write behavior during asset-cache uploads. |
Review effort: Lite
| return file->read(buffer, size, nitems); | ||
| } | ||
|
|
||
| static size_t discard_response_callback(char*, size_t size, size_t nmemb, void*) { return size * nmemb; } |
| vcpkg_curl_easy_setopt(curl, CURLOPT_READDATA, static_cast<void*>(&fileptr)); | ||
| vcpkg_curl_easy_setopt(curl, CURLOPT_READFUNCTION, &read_file_callback); | ||
| vcpkg_curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, static_cast<curl_off_t>(file_size)); | ||
| vcpkg_curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &discard_response_callback); |
| return file->read(buffer, size, nitems); | ||
| } | ||
|
|
||
| static size_t discard_response_callback(char*, size_t size, size_t nmemb, void*) { return size * nmemb; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Set a write callback in store_to_asset_cache() to discard response bodies instead of letting libcurl write them to stdout.