fix: use CURLOPT_POSTFIELDSIZE_LARGE to tell libcurl of the post content size

This commit is contained in:
Tomasz Sowa 2022-08-13 17:15:48 +02:00
parent ceb5336ca1
commit ca1a854fd1
1 changed files with 2 additions and 6 deletions

View File

@ -477,12 +477,8 @@ bool Http::fetch_internal(const char * url, const std::string * in, pt::TextStre
curl_easy_setopt(curl, CURLOPT_SEEKDATA, this);
curl_easy_setopt(curl, CURLOPT_POST, 1);
/*
* do not set content-leght header here
* curl uses "Expect: 100-continue" and it collides if Content-Length is set
* https://daniel.haxx.se/blog/2020/02/27/expect-tweaks-in-curl/
*
*/
curl_off_t size = read_function_input->size();
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, size);
}
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fetch_write_function);