diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-30 14:15:07 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-30 14:15:07 +0200 |
commit | 5abfb9ab5749676bc41e9babe3f734dc6e9a12be (patch) | |
tree | 93c347f527c91ba6194befd3e4b715f0e61a018a | |
parent | d8775103a55be65c427c1cacef4172382cef97d1 (diff) | |
download | abrt-5abfb9ab5749676bc41e9babe3f734dc6e9a12be.tar.gz abrt-5abfb9ab5749676bc41e9babe3f734dc6e9a12be.tar.xz abrt-5abfb9ab5749676bc41e9babe3f734dc6e9a12be.zip |
trivial: better HTTP/curl error reporting
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | lib/Utils/abrt_curl.cpp | 4 | ||||
-rw-r--r-- | lib/Utils/abrt_rh_support.cpp | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/Utils/abrt_curl.cpp b/lib/Utils/abrt_curl.cpp index 6dc8582f..edc27124 100644 --- a/lib/Utils/abrt_curl.cpp +++ b/lib/Utils/abrt_curl.cpp @@ -135,8 +135,12 @@ curl_post(curl_post_state_t* state, const char* url, const char* data) curl_err = curl_easy_perform(handle); if (curl_err) { + VERB2 log("curl_easy_perform: error %d", (int)curl_err); if (state->flags & ABRT_CURL_POST_WANT_ERROR_MSG) + { state->curl_error_msg = check_curl_error(curl_err, "curl_easy_perform"); + VERB3 log("curl_easy_perform: error_msg: %s", state->curl_error_msg); + } goto ret; } diff --git a/lib/Utils/abrt_rh_support.cpp b/lib/Utils/abrt_rh_support.cpp index ff8ce48b..be2d3961 100644 --- a/lib/Utils/abrt_rh_support.cpp +++ b/lib/Utils/abrt_rh_support.cpp @@ -204,12 +204,21 @@ post_signature(const char* baseURL, const char* signature) strata_msg = find_header_in_curl_post_state(state, "Strata-Message:"); if (strata_msg) { - retval = xasprintf("Error (HTTP response %d): %s", + retval = xasprintf("Error (HTTP response %d): %s", http_resp_code, strata_msg); - break; + break; + } + if (state->curl_error_msg) + { + if (http_resp_code >= 0) + retval = xasprintf("Error (HTTP response %d): %s", http_resp_code, state->curl_error_msg); + else + retval = xasprintf("Error in HTTP transaction: %s", state->curl_error_msg); + break; } retval = xasprintf("Error (HTTP response %d), body:\n%s", http_resp_code, state->body); + break; } free_curl_post_state(state); |