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:
parent
9a695f9067
commit
f1968ea38e
4 changed files with 22 additions and 7 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue