1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-20 09:19:36 +01:00

refactor(libstore): replace HTTP method boolean flags with enum

Replace the individual boolean flags (head, post) with a unified
HttpMethod enum struct in FileTransferRequest.
This commit is contained in:
Bernardo Meurer Costa 2025-10-23 05:03:16 +00:00
parent 9a695f9067
commit f1968ea38e
No known key found for this signature in database
4 changed files with 22 additions and 7 deletions

View file

@ -384,11 +384,11 @@ struct curlFileTransfer : public FileTransfer
if (settings.downloadSpeed.get() > 0)
curl_easy_setopt(req, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t) (settings.downloadSpeed.get() * 1024));
if (request.head)
if (request.method == HttpMethod::HEAD)
curl_easy_setopt(req, CURLOPT_NOBODY, 1);
if (request.data) {
if (request.post) {
if (request.method == HttpMethod::POST) {
curl_easy_setopt(req, CURLOPT_POST, 1L);
curl_easy_setopt(req, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t) request.data->length());
} else {