Blame SOURCES/0156-ureport-improve-curl-s-error-messages.patch

057568
From b3d0e0225d155744f5aece391db31644dd7bd83a Mon Sep 17 00:00:00 2001
057568
From: Matej Habrnal <mhabrnal@redhat.com>
057568
Date: Wed, 16 Sep 2015 14:44:31 +0200
057568
Subject: [PATCH] ureport: improve curl's error messages
057568
057568
There were cases the 'post_state->errmsg' was empty and error message looks
057568
like "Failed to upload uReport to the server 'https://localhost:12345/faf' with
057568
curl:". This is kind of confusing because there is no information related to
057568
curl error part.  In the case the 'post_state->errmsg' is empty, error message
057568
without "with curl:" part will be printed. Also print information stored in
057568
'post_state->curl_error_msg', if is not empty.
057568
057568
Now, in the case the 'post_state->errmsg' is empty, the error message may look
057568
like this:
057568
Failed to upload uReport to the server 'https://localhost:12345/faf'
057568
Error: curl_easy_perform: Problem with the SSL CA cert (path? access rights?)
057568
057568
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
057568
---
057568
 src/lib/ureport.c | 11 ++++++++++-
057568
 1 file changed, 10 insertions(+), 1 deletion(-)
057568
057568
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
057568
index 76bcc95..ebeaa8b 100644
057568
--- a/src/lib/ureport.c
057568
+++ b/src/lib/ureport.c
057568
@@ -566,7 +566,16 @@ ureport_server_response_from_reply(post_state_t *post_state,
057568
      */
057568
     if (post_state->curl_result != CURLE_OK)
057568
     {
057568
-        error_msg(_("Failed to upload uReport to the server '%s' with curl: %s"), config->ur_url, post_state->errmsg);
057568
+        if (post_state->errmsg != NULL && strcmp( post_state->errmsg, "") != 0)
057568
+            error_msg(_("Failed to upload uReport to the server '%s' with curl: %s"),
057568
+                                                                    config->ur_url,
057568
+                                                                    post_state->errmsg);
057568
+        else
057568
+            error_msg(_("Failed to upload uReport to the server '%s'"), config->ur_url);
057568
+
057568
+        if (post_state->curl_error_msg != NULL && strcmp(post_state->curl_error_msg, "") != 0)
057568
+            error_msg(_("Error: %s"), post_state->curl_error_msg);
057568
+
057568
         return NULL;
057568
     }
057568
 
057568
-- 
057568
2.4.3
057568