1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-28 13:11:00 +01:00

Merge pull request #14587 from NixOS/fix-mingw

treewide: Fix MinGW build
This commit is contained in:
John Ericson 2025-11-18 02:17:38 +00:00 committed by GitHub
commit 16f0279d4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 44 additions and 25 deletions

View file

@ -386,17 +386,17 @@ 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.method == HttpMethod::HEAD)
if (request.method == HttpMethod::Head)
curl_easy_setopt(req, CURLOPT_NOBODY, 1);
if (request.method == HttpMethod::DELETE)
if (request.method == HttpMethod::Delete)
curl_easy_setopt(req, CURLOPT_CUSTOMREQUEST, "DELETE");
if (request.data) {
if (request.method == HttpMethod::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->sizeHint);
} else if (request.method == HttpMethod::PUT) {
} else if (request.method == HttpMethod::Put) {
curl_easy_setopt(req, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(req, CURLOPT_INFILESIZE_LARGE, (curl_off_t) request.data->sizeHint);
} else {

View file

@ -120,7 +120,7 @@ bool HttpBinaryCacheStore::fileExists(const std::string & path)
try {
FileTransferRequest request(makeRequest(path));
request.method = HttpMethod::HEAD;
request.method = HttpMethod::Head;
getFileTransfer()->download(request);
return true;
} catch (FileTransferError & e) {
@ -141,7 +141,7 @@ void HttpBinaryCacheStore::upload(
std::optional<Headers> headers)
{
auto req = makeRequest(path);
req.method = HttpMethod::PUT;
req.method = HttpMethod::Put;
if (headers) {
req.headers.reserve(req.headers.size() + headers->size());

View file

@ -87,11 +87,11 @@ extern const unsigned int RETRY_TIME_MS_DEFAULT;
* HTTP methods supported by FileTransfer.
*/
enum struct HttpMethod {
GET,
PUT,
HEAD,
POST,
DELETE,
Get,
Put,
Head,
Post,
Delete,
};
/**
@ -110,7 +110,7 @@ struct FileTransferRequest
VerbatimURL uri;
Headers headers;
std::string expectedETag;
HttpMethod method = HttpMethod::GET;
HttpMethod method = HttpMethod::Get;
size_t tries = fileTransferSettings.tries;
unsigned int baseRetryTimeMs = RETRY_TIME_MS_DEFAULT;
ActivityId parentAct;
@ -164,14 +164,14 @@ struct FileTransferRequest
std::string verb() const
{
switch (method) {
case HttpMethod::HEAD:
case HttpMethod::GET:
case HttpMethod::Head:
case HttpMethod::Get:
return "download";
case HttpMethod::PUT:
case HttpMethod::POST:
case HttpMethod::Put:
case HttpMethod::Post:
assert(data);
return "upload";
case HttpMethod::DELETE:
case HttpMethod::Delete:
return "delet";
}
unreachable();

View file

@ -295,7 +295,7 @@ std::string S3BinaryCacheStore::createMultipartUpload(
url.query["uploads"] = "";
req.uri = VerbatimURL(url);
req.method = HttpMethod::POST;
req.method = HttpMethod::Post;
StringSource payload{std::string_view("")};
req.data = {payload};
req.mimeType = mimeType;
@ -325,7 +325,7 @@ S3BinaryCacheStore::uploadPart(std::string_view key, std::string_view uploadId,
}
auto req = makeRequest(key);
req.method = HttpMethod::PUT;
req.method = HttpMethod::Put;
req.setupForS3();
auto url = req.uri.parsed();
@ -355,7 +355,7 @@ void S3BinaryCacheStore::abortMultipartUpload(std::string_view key, std::string_
auto url = req.uri.parsed();
url.query["uploadId"] = uploadId;
req.uri = VerbatimURL(url);
req.method = HttpMethod::DELETE;
req.method = HttpMethod::Delete;
getFileTransfer()->enqueueFileTransfer(req).get();
} catch (...) {
@ -372,7 +372,7 @@ void S3BinaryCacheStore::completeMultipartUpload(
auto url = req.uri.parsed();
url.query["uploadId"] = uploadId;
req.uri = VerbatimURL(url);
req.method = HttpMethod::POST;
req.method = HttpMethod::Post;
std::string xml = "<CompleteMultipartUpload>";
for (const auto & [idx, etag] : enumerate(partEtags)) {