From 8abc5082222b7f65e07453a0aca46ce6d25ce3a5 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 5 Sep 2011 17:29:34 -0500 Subject: http: remove extra newline in error message There is no need for a blank line between the detailed error message and the later "fatal: HTTP request failed" notice. Keep the newline written by error() itself and eliminate the extra one. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano diff --git a/http.c b/http.c index b2ae8de..7419751 100644 --- a/http.c +++ b/http.c @@ -903,7 +903,7 @@ int http_error(const char *url, int ret) { /* http_request has already handled HTTP_START_FAILED. */ if (ret != HTTP_START_FAILED) - error("%s while accessing %s\n", curl_errorstr, url); + error("%s while accessing %s", curl_errorstr, url); return ret; } -- cgit v0.10.2-6-g49f6 From be22d92eac809ad2bfa2b7c83ad7cad5a15f1c43 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 5 Sep 2011 17:22:02 -0500 Subject: http: avoid empty error messages for some curl errors When asked to fetch over SSL without a valid /etc/ssl/certs/ca-certificates.crt file, "git fetch" writes error: while accessing https://github.com/torvalds/linux.git/info/refs which is a little disconcerting. Better to fall back to curl_easy_strerror(result) when the error string is empty, like the curl utility does: error: Problem with the SSL CA cert (path? access rights?) while accessing https://github.com/torvalds/linux.git/info/refs Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano diff --git a/http.c b/http.c index 7419751..61a9089 100644 --- a/http.c +++ b/http.c @@ -846,8 +846,13 @@ static int http_request(const char *url, void *result, int target, int options) init_curl_http_auth(slot->curl); ret = HTTP_REAUTH; } - } else + } else { + if (!curl_errorstr[0]) + strlcpy(curl_errorstr, + curl_easy_strerror(results.curl_result), + sizeof(curl_errorstr)); ret = HTTP_ERROR; + } } else { error("Unable to start HTTP request for %s", url); ret = HTTP_START_FAILED; -- cgit v0.10.2-6-g49f6