Set explicit Content-Length: 0 when initiating MPU (#1696)

This works around a GCS quirk that incorrectly requires this header.
Fixes #1661.
This commit is contained in:
Andrew Gaul 2021-06-25 18:36:40 +09:00 committed by GitHub
parent 0555c4216e
commit 20281737b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3528,7 +3528,6 @@ int S3fsCurl::PreMultipartPostRequest(const char* tpath, headers_t& meta, std::s
} }
requestHeaders = curl_slist_sort_insert(requestHeaders, "Accept", NULL); requestHeaders = curl_slist_sort_insert(requestHeaders, "Accept", NULL);
requestHeaders = curl_slist_sort_insert(requestHeaders, "Content-Length", NULL);
requestHeaders = curl_slist_sort_insert(requestHeaders, "Content-Type", contype.c_str()); requestHeaders = curl_slist_sort_insert(requestHeaders, "Content-Type", contype.c_str());
op = "POST"; op = "POST";
@ -3540,6 +3539,7 @@ int S3fsCurl::PreMultipartPostRequest(const char* tpath, headers_t& meta, std::s
curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void*)&bodydata); curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void*)&bodydata);
curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
curl_easy_setopt(hCurl, CURLOPT_POSTFIELDSIZE, 0); curl_easy_setopt(hCurl, CURLOPT_POSTFIELDSIZE, 0);
curl_easy_setopt(hCurl, CURLOPT_INFILESIZE, 0); // Content-Length
S3fsCurl::AddUserAgent(hCurl); // put User-Agent S3fsCurl::AddUserAgent(hCurl); // put User-Agent
// request // request