mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix
This commit is contained in:
parent
9226f362a7
commit
946728e54e
3 changed files with 28 additions and 2 deletions
|
|
@ -80,6 +80,9 @@ public:
|
|||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/7.81.0");
|
||||
#ifndef NDEBUG
|
||||
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
#endif
|
||||
if (request.maxSize == 0) {
|
||||
curl_easy_setopt(
|
||||
curl, CURLOPT_MAXFILESIZE, std::numeric_limits<long>::max()
|
||||
|
|
@ -119,7 +122,8 @@ public:
|
|||
if(msg->msg == CURLMSG_DONE) {
|
||||
curl_multi_remove_handle(multiHandle, curl);
|
||||
}
|
||||
int response;
|
||||
int response = -1;
|
||||
CURLcode result = msg->data.result;
|
||||
curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &response);
|
||||
if (response == HTTP_OK) {
|
||||
long size;
|
||||
|
|
@ -133,6 +137,11 @@ public:
|
|||
if (onResponse) {
|
||||
onResponse(std::move(buffer));
|
||||
}
|
||||
} else if (response == 0) {
|
||||
logger.error() << curl_easy_strerror(result) << " (" << url << ")";
|
||||
if (onReject) {
|
||||
onReject(response, {});
|
||||
}
|
||||
} else {
|
||||
logger.error()
|
||||
<< "response code " << response << " (" << url << ")"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue