Skip to content

Suppress HTTP cache upload response bodies - #2184

Open
Osyotr (Osyotr) wants to merge 2 commits into
microsoft:mainfrom
Osyotr:patch-1
Open

Osyotr (Osyotr) wants to merge 2 commits into
microsoft:mainfrom
Osyotr:patch-1

Conversation

@Osyotr

Copy link
Copy Markdown
Contributor

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

Set a write callback in store_to_asset_cache() to discard response
bodies instead of letting libcurl write them to stdout.
Copilot AI balanced review requested due to automatic review settings November 9, 2026 07:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Copilot was unable to run its full agentic suite in this review.

Copilot review overview

3 open issues
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_WRITEFUNCTION callback 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; }
Copilot AI balanced review requested due to automatic review settings November 13, 2026 00:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants