ENH: close logging in console of libcurl

Change-Id: I434f733a66ee79af762cfc2e52c28aba0e192d97
Signed-off-by: Stone Li <stone.li@bambulab.com>
(cherry picked from commit 2886ebbbedf60cd131cbd14594223ad5c5795b1d)
This commit is contained in:
Stone Li 2023-08-03 15:27:38 +08:00 committed by lane.wei
parent 2f09e25e95
commit 91f3c7bd1b

View file

@ -143,6 +143,14 @@ struct Http::priv
void http_perform();
};
// add a dummy log callback
static int log_trace(CURL* handle, curl_infotype type,
char* data, size_t size,
void* userp)
{
return 0;
}
Http::priv::priv(const std::string &url)
: curl(::curl_easy_init())
, form(nullptr)
@ -161,6 +169,7 @@ Http::priv::priv(const std::string &url)
set_timeout_connect(DEFAULT_TIMEOUT_CONNECT);
set_timeout_max(DEFAULT_TIMEOUT_MAX);
::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, log_trace);
::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); // curl makes a copy internally
::curl_easy_setopt(curl, CURLOPT_USERAGENT, SLIC3R_APP_NAME "/" SLIC3R_VERSION);
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer.front());