summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-09-05 17:22:02 -0500
committerJunio C Hamano <gitster@pobox.com>2011-09-06 15:49:23 -0700
commitbe22d92eac809ad2bfa2b7c83ad7cad5a15f1c43 (patch)
tree00b16e38ddba2da091c1091b74bc5ec80e3e76ee /http.c
parent8abc5082222b7f65e07453a0aca46ce6d25ce3a5 (diff)
downloadgit-be22d92eac809ad2bfa2b7c83ad7cad5a15f1c43.tar.gz
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 <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/http.c b/http.c
index 74197519b1..61a90896ec 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;