Skip to content

Commit 5b5d92a

Browse files
committed
Merge jn/maint-http-error-message
* commit 'be22d92eac809ad2bfa2b7c83ad7cad5a15f1c43': http: avoid empty error messages for some curl errors http: remove extra newline in error message
2 parents a76a326 + be22d92 commit 5b5d92a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

http.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,13 @@ static int http_request(const char *url, void *result, int target, int options)
851851
init_curl_http_auth(slot->curl);
852852
ret = HTTP_REAUTH;
853853
}
854-
} else
854+
} else {
855+
if (!curl_errorstr[0])
856+
strlcpy(curl_errorstr,
857+
curl_easy_strerror(results.curl_result),
858+
sizeof(curl_errorstr));
855859
ret = HTTP_ERROR;
860+
}
856861
} else {
857862
error("Unable to start HTTP request for %s", url);
858863
ret = HTTP_START_FAILED;
@@ -908,7 +913,7 @@ int http_error(const char *url, int ret)
908913
{
909914
/* http_request has already handled HTTP_START_FAILED. */
910915
if (ret != HTTP_START_FAILED)
911-
error("%s while accessing %s\n", curl_errorstr, url);
916+
error("%s while accessing %s", curl_errorstr, url);
912917

913918
return ret;
914919
}

0 commit comments

Comments
 (0)