Skip to content

Commit

Permalink
http: avoid empty error messages for some curl errors
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Sep 6, 2011
1 parent 8abc508 commit be22d92
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit be22d92

Please sign in to comment.