Skip to content
Permalink
Browse files

Print libcurl error buffer to stderr on client error

  • Loading branch information...
LBPHacker committed Apr 5, 2019
1 parent e3fefe3 commit ff39c82e48025683c332ea32c989dea5cec94d85
Showing with 11 additions and 0 deletions.
  1. +3 −0 src/client/http/Request.cpp
  2. +1 −0 src/client/http/Request.h
  3. +7 −0 src/client/http/RequestManager.cpp
@@ -159,6 +159,9 @@ namespace http
curl_easy_setopt(easy, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(easy, CURLOPT_MAXREDIRS, 10L);

curl_easy_setopt(easy, CURLOPT_ERRORBUFFER, error_buffer);
error_buffer[0] = 0;

curl_easy_setopt(easy, CURLOPT_TIMEOUT, timeout);
curl_easy_setopt(easy, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(easy, CURLOPT_URL, uri.c_str());
@@ -25,6 +25,7 @@ namespace http
ByteString response_body;

CURL *easy;
char error_buffer[CURL_ERROR_SIZE];

volatile curl_off_t rm_total;
volatile curl_off_t rm_done;
@@ -3,6 +3,8 @@
#include "Config.h"
#include "Platform.h"

#include <iostream>

const int curl_multi_wait_timeout_ms = 100;
const long curl_max_host_connections = 6;

@@ -142,6 +144,11 @@ namespace http
break;
}

if (finish_with >= 600)
{
std::cerr << request->error_buffer << std::endl;
}

request->status = finish_with;
}
};

0 comments on commit ff39c82

Please sign in to comment.
You can’t perform that action at this time.