# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1313374632 18000 # Node ID 27e5f0e79f19f5d4ca3962f1f6335fa11b5b3712 # Parent 55c3da8f1c9ac4fc61965a1d4b7b73a13f4a212a Return better error codes from curl, even if connection is successful diff -r 55c3da8f1c9a -r 27e5f0e79f19 src/DLD-FUNCTIONS/urlwrite.cc --- a/src/DLD-FUNCTIONS/urlwrite.cc Sun Aug 14 12:41:20 2011 -0500 +++ b/src/DLD-FUNCTIONS/urlwrite.cc Sun Aug 14 21:17:12 2011 -0500 @@ -112,11 +112,11 @@ { BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CURLcode res = curl_easy_perform (curl); - if (res != CURLE_OK) + errnum = curl_easy_perform (curl); + if (errnum != CURLE_OK) { if (curlerror) - error ("%s", curl_easy_strerror (res)); + error ("%s", curl_easy_strerror (errnum)); } else retval = true; @@ -145,6 +145,7 @@ std::string host; bool valid; bool ascii; + mutable CURLcode errnum; private: CURL *curl; @@ -250,11 +251,7 @@ std::string lasterror (void) const { - CURLcode errnum; - - curl_easy_getinfo (rep->handle(), CURLINFO_OS_ERRNO, &errnum); - - return std::string (curl_easy_strerror (errnum)); + return std::string (curl_easy_strerror (rep->errnum)); } void set_ostream (std::ostream& os) const