remote-curl: include curl_errorstr on SSL setup failures
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>
Shawn Pearce committed
Feb 13, 2016 at 17:39 UTC
00540458a82ff2454ae1cc63e38a9ce4a1eea878
1 file changed
+14
-2
remote-curl.c
+14
-2
@@ -439,8 +439,20 @@ static int run_slot(struct active_request_slot *slot,
439
err = run_one_slot(slot, results);
440
441
if (err != HTTP_OK && err != HTTP_REAUTH) {
442
- error("RPC failed; result=%d, HTTP code = %ld",
443
- results->curl_result, results->http_code);
442
+ struct strbuf msg = STRBUF_INIT;
443
+ if (results->http_code && results->http_code != 200)
444
+ strbuf_addf(&msg, "HTTP %ld", results->http_code);
445
+ if (results->curl_result != CURLE_OK) {
446
+ if (msg.len)
447
+ strbuf_addch(&msg, ' ');
448
+ strbuf_addf(&msg, "curl %d", results->curl_result);
449
+ if (curl_errorstr[0]) {
450
+ strbuf_addch(&msg, ' ');
451
+ strbuf_addstr(&msg, curl_errorstr);
452
+ }
453
+ }
454
+ error("RPC failed; %s", msg.buf);
455
+ strbuf_release(&msg);
456
}
457
458
return err;