Skip to content

Commit

Permalink
Fix response body being printed to server console during file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikMinekus committed Mar 29, 2021
1 parent 2ca183a commit f50b9e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions httpfilecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

#include "httpfilecontext.h"

static size_t IgnoreResponseBody(void *body, size_t size, size_t nmemb, void *userdata)
{
return size * nmemb;
}

HTTPFileContext::HTTPFileContext(bool isUpload, const std::string &url, const std::string &path,
struct curl_slist *headers, IChangeableForward *forward, cell_t value,
long connectTimeout, long maxRedirects, long timeout, curl_off_t maxSendSpeed, curl_off_t maxRecvSpeed,
Expand Down Expand Up @@ -62,6 +67,7 @@ bool HTTPFileContext::InitCurl()
curl_easy_setopt(curl, CURLOPT_READDATA, file);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &IgnoreResponseBody);
}
else
{
Expand Down

0 comments on commit f50b9e4

Please sign in to comment.