summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2016-02-13 17:39:34 -0800
committerJunio C Hamano <gitster@pobox.com>2016-02-15 13:21:43 -0800
commit00540458a82ff2454ae1cc63e38a9ce4a1eea878 (patch)
tree4582a0ee4e7fab32af5d1b3afb683d2d46f9745e /remote-curl.c
parenta08595f76159b09d57553e37a5123f1091bb13e7 (diff)
downloadgit-00540458a82ff2454ae1cc63e38a9ce4a1eea878.tar.gz
remote-curl: include curl_errorstr on SSL setup failuressp/remote-curl-ssl-strerror
For curl error 35 (CURLE_SSL_CONNECT_ERROR) users need the additional text stored in CURLOPT_ERRORBUFFER to debug why the connection did not start. This is curl_errorstr inside of http.c, so include that in the message if it is non-empty. Sometimes HTTP response codes aren't yet available, such as when the SSL setup fails. Don't include HTTP 0 in the message. Signed-off-by: Shawn Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/remote-curl.c b/remote-curl.c
index f404faf0f4..e114f24448 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -439,8 +439,20 @@ static int run_slot(struct active_request_slot *slot,
err = run_one_slot(slot, results);
if (err != HTTP_OK && err != HTTP_REAUTH) {
- error("RPC failed; result=%d, HTTP code = %ld",
- results->curl_result, results->http_code);
+ struct strbuf msg = STRBUF_INIT;
+ if (results->http_code && results->http_code != 200)
+ strbuf_addf(&msg, "HTTP %ld", results->http_code);
+ if (results->curl_result != CURLE_OK) {
+ if (msg.len)
+ strbuf_addch(&msg, ' ');
+ strbuf_addf(&msg, "curl %d", results->curl_result);
+ if (curl_errorstr[0]) {
+ strbuf_addch(&msg, ' ');
+ strbuf_addstr(&msg, curl_errorstr);
+ }
+ }
+ error("RPC failed; %s", msg.buf);
+ strbuf_release(&msg);
}
return err;