Skip to content

Commit 324bfd8

Browse files
authored
Merge pull request #14337 from lovesegfault/fix-post-large
fix(libstore): use CURLOPT_POSTFIELDSIZE_LARGE for POST requests
2 parents 8e01e4a + 953929f commit 324bfd8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libstore/filetransfer.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,13 +388,15 @@ struct curlFileTransfer : public FileTransfer
388388
curl_easy_setopt(req, CURLOPT_NOBODY, 1);
389389

390390
if (request.data) {
391-
if (request.post)
391+
if (request.post) {
392392
curl_easy_setopt(req, CURLOPT_POST, 1L);
393-
else
393+
curl_easy_setopt(req, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t) request.data->length());
394+
} else {
394395
curl_easy_setopt(req, CURLOPT_UPLOAD, 1L);
396+
curl_easy_setopt(req, CURLOPT_INFILESIZE_LARGE, (curl_off_t) request.data->length());
397+
}
395398
curl_easy_setopt(req, CURLOPT_READFUNCTION, readCallbackWrapper);
396399
curl_easy_setopt(req, CURLOPT_READDATA, this);
397-
curl_easy_setopt(req, CURLOPT_INFILESIZE_LARGE, (curl_off_t) request.data->length());
398400
curl_easy_setopt(req, CURLOPT_SEEKFUNCTION, seekCallbackWrapper);
399401
curl_easy_setopt(req, CURLOPT_SEEKDATA, this);
400402
}

0 commit comments

Comments
 (0)