ENH: close logging in console of libcurl

Change-Id: I434f733a66ee79af762cfc2e52c28aba0e192d97
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-08-03 15:27:38 +08:00 committed by Lane.Wei
parent c31ff2d43c
commit 19f6fec6c4
1 changed files with 9 additions and 0 deletions

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());