From: Daniel Stenberg Date: Thu, 18 May 2023 12:27:01 +0000 (+0200) Subject: url: provide better error message when URLs fail to parse X-Git-Tag: curl-8_1_1~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f1e5d8a731e3266a18d90803f23b10db75445bce;p=thirdparty%2Fcurl.git url: provide better error message when URLs fail to parse By providing the URL API error message into the error message. Ref: #11129 Closes #11137 --- diff --git a/lib/url.c b/lib/url.c index de70eee234..501a0fc6a9 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1755,14 +1755,13 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data, if(!use_set_uh) { char *newurl; uc = curl_url_set(uh, CURLUPART_URL, data->state.url, - CURLU_GUESS_SCHEME | - CURLU_NON_SUPPORT_SCHEME | - (data->set.disallow_username_in_url ? - CURLU_DISALLOW_USER : 0) | - (data->set.path_as_is ? CURLU_PATH_AS_IS : 0)); + CURLU_GUESS_SCHEME | + CURLU_NON_SUPPORT_SCHEME | + (data->set.disallow_username_in_url ? + CURLU_DISALLOW_USER : 0) | + (data->set.path_as_is ? CURLU_PATH_AS_IS : 0)); if(uc) { - DEBUGF(infof(data, "curl_url_set rejected %s: %s", data->state.url, - curl_url_strerror(uc))); + failf(data, "URL rejected: %s", curl_url_strerror(uc)); return Curl_uc_to_curlcode(uc); } @@ -2176,7 +2175,8 @@ static CURLcode parse_proxy(struct Curl_easy *data, } } else { - failf(data, "Unsupported proxy syntax in \'%s\'", proxy); + failf(data, "Unsupported proxy syntax in \'%s\': %s", proxy, + curl_url_strerror(uc)); result = CURLE_COULDNT_RESOLVE_PROXY; goto error; }