Skip to content

Commit e6d14ba

Browse files
committed
net: CurlHttpClient: Call curl_easy_reset() to fix error 'rewinding of the data'
@okman334 reported an error when using the curl HTTP client after commit 775291f ("net: Allow curl handle in CurlHttpClient to be kept alive"): error: curl error: Send failed since rewinding of the data stream failed. Fix this by calling `curl_easy_reset()` before setting curl options. It reinitializes all options previously set on a specified curl handle to the default values while keeping the connection alive. Closes: #340 Reported-by: @okman334 Fixes: 775291f ("net: Allow curl handle in CurlHttpClient to be kept alive") Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
1 parent 84e93a1 commit e6d14ba

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/net/CurlHttpClient.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ static std::size_t curlWriteString(char* ptr, std::size_t size, std::size_t nmem
4545
std::string CurlHttpClient::makeRequest(const Url& url, const std::vector<HttpReqArg>& args) const {
4646
CURL* curl = getCurlHandle(this);
4747

48+
curl_easy_reset(curl);
4849
std::string u = url.protocol + "://" + url.host + url.path;
4950
if (args.empty()) {
5051
u += "?" + url.query;

0 commit comments

Comments
 (0)