Upload PUT read file in binary mode

This commit is contained in:
David Kocik 2023-10-09 09:55:06 +02:00
parent 6b94d09fe6
commit b5ac8f4d53

View File

@ -314,7 +314,7 @@ void Http::priv::set_put_body(const fs::path &path)
boost::system::error_code ec;
boost::uintmax_t filesize = file_size(path, ec);
if (!ec) {
putFile = std::make_unique<fs::ifstream>(path);
putFile = std::make_unique<fs::ifstream>(path, std::ios::binary);
::curl_easy_setopt(curl, CURLOPT_READDATA, (void *) (putFile.get()));
::curl_easy_setopt(curl, CURLOPT_INFILESIZE, filesize);
}