diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2018-06-02 13:24:17 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2018-06-02 13:24:31 -0400 |
commit | f448041ec0a6ce5caead0829f309a06cabcdd156 (patch) | |
tree | 6583ff36a80f41a40f37ceb0bd2aeb1a838d5af1 /gtk2_ardour/ardour_http.cc | |
parent | 820cbc8c4f79769d43e56f06ab79c92ce6d2363a (diff) |
no error logging for CURL HTTP requests; future callers can request it if necessary
Diffstat (limited to 'gtk2_ardour/ardour_http.cc')
-rw-r--r-- | gtk2_ardour/ardour_http.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gtk2_ardour/ardour_http.cc b/gtk2_ardour/ardour_http.cc index a67522d90d..05e23b32d4 100644 --- a/gtk2_ardour/ardour_http.cc +++ b/gtk2_ardour/ardour_http.cc @@ -179,13 +179,16 @@ HttpGet::~HttpGet () } char* -HttpGet::get (const char* url) +HttpGet::get (const char* url, bool with_error_logging) { #ifdef ARDOURCURLDEBUG - std::cerr << "HttpGet::get() ---- new request ---"<< std::endl; + std::cerr << "HttpGet::get() ---- new request ---"<< std::endl; #endif _status = _result = -1; if (!_curl || !url) { + if (with_error_logging) { + PBD::error << "HttpGet::get() not initialized (or NULL url)"<< endmsg; + } #ifdef ARDOURCURLDEBUG std::cerr << "HttpGet::get() not initialized (or NULL url)"<< std::endl; #endif @@ -193,6 +196,9 @@ HttpGet::get (const char* url) } if (strncmp ("http://", url, 7) && strncmp ("https://", url, 8)) { + if (with_error_logging) { + PBD::error << "HttpGet::get() not a http[s] URL"<< endmsg; + } #ifdef ARDOURCURLDEBUG std::cerr << "HttpGet::get() not a http[s] URL"<< std::endl; #endif @@ -216,12 +222,18 @@ HttpGet::get (const char* url) CCERR ("CURLINFO_RESPONSE_CODE,"); if (_result) { + if (with_error_logging) { + PBD::error << string_compose (_("HTTP request failed: (%1) %2"), _result, error_buffer) << endmsg; + } #ifdef ARDOURCURLDEBUG std::cerr << string_compose (_("HTTP request failed: (%1) %2"), _result, error_buffer) << std::endl; #endif return NULL; } if (_status != 200) { + if (with_error_logging) { + PBD::error << string_compose (_("HTTP request status: %1"), _status) << endmsg; + } #ifdef ARDOURCURLDEBUG std::cerr << string_compose (_("HTTP request status: %1"), _status) << std::endl; #endif @@ -243,9 +255,9 @@ HttpGet::error () const { } char* -ArdourCurl::http_get (const char* url, int* status) { +ArdourCurl::http_get (const char* url, int* status, bool with_error_logging) { HttpGet h (true); - char* rv = h.get (url); + char* rv = h.get (url, with_error_logging); if (status) { *status = h.status (); } @@ -253,6 +265,6 @@ ArdourCurl::http_get (const char* url, int* status) { } std::string -ArdourCurl::http_get (const std::string& url) { - return HttpGet (false).get (url); +ArdourCurl::http_get (const std::string& url, bool with_error_logging) { + return HttpGet (false).get (url, with_error_logging); } |