From 953929f8990b6ca639b65d9f105c823c770bf7c1 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Costa Date: Wed, 22 Oct 2025 20:08:33 +0000 Subject: [PATCH] fix(libstore): use CURLOPT_POSTFIELDSIZE_LARGE for POST requests Fix POST requests with data to use the correct curl option for specifying body size. Previously used CURLOPT_INFILESIZE_LARGE for both POST and PUT, but POST requires CURLOPT_POSTFIELDSIZE_LARGE. This caused POST request bodies to not be sent correctly, manifesting as S3 multipart CompleteMultipartUpload requests failing with "You must specify at least one part" even though the XML body contained valid parts. --- src/libstore/filetransfer.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index 201f2984e..68c8a9e3a 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -388,13 +388,15 @@ struct curlFileTransfer : public FileTransfer curl_easy_setopt(req, CURLOPT_NOBODY, 1); if (request.data) { - if (request.post) + if (request.post) { curl_easy_setopt(req, CURLOPT_POST, 1L); - else + curl_easy_setopt(req, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t) request.data->length()); + } else { curl_easy_setopt(req, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(req, CURLOPT_INFILESIZE_LARGE, (curl_off_t) request.data->length()); + } curl_easy_setopt(req, CURLOPT_READFUNCTION, readCallbackWrapper); curl_easy_setopt(req, CURLOPT_READDATA, this); - curl_easy_setopt(req, CURLOPT_INFILESIZE_LARGE, (curl_off_t) request.data->length()); curl_easy_setopt(req, CURLOPT_SEEKFUNCTION, seekCallbackWrapper); curl_easy_setopt(req, CURLOPT_SEEKDATA, this); }