mirror of
https://github.com/curl/curl.git
synced 2025-09-16 17:12:43 +03:00
tool_operate: provide better errmsg for -G with bad URL
If the URL that -G would try to add a query to could not be parsed, it would display curl: (27) Out of memory It now instead shows: curl: (2) Could not parse the URL, failed to set query Reported-by: Alex Xu Fixes #9889 Closes #9892
This commit is contained in:
parent
aecc549699
commit
7f182f7136
|
@ -1195,16 +1195,24 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
|||
if(uh) {
|
||||
char *updated;
|
||||
if(curl_url_set(uh, CURLUPART_URL, per->this_url,
|
||||
CURLU_GUESS_SCHEME) ||
|
||||
curl_url_set(uh, CURLUPART_QUERY, q, CURLU_APPENDQUERY) ||
|
||||
curl_url_get(uh, CURLUPART_URL, &updated, CURLU_GUESS_SCHEME)) {
|
||||
curl_url_cleanup(uh);
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
break;
|
||||
CURLU_GUESS_SCHEME)) {
|
||||
result = CURLE_FAILED_INIT;
|
||||
errorf(global, "(%d) Could not parse the URL, "
|
||||
"failed to set query\n", result);
|
||||
config->synthetic_error = TRUE;
|
||||
}
|
||||
else if(curl_url_set(uh, CURLUPART_QUERY, q, CURLU_APPENDQUERY) ||
|
||||
curl_url_get(uh, CURLUPART_URL, &updated,
|
||||
CURLU_GUESS_SCHEME)) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
else {
|
||||
Curl_safefree(per->this_url); /* free previous URL */
|
||||
per->this_url = updated; /* use our new URL instead! */
|
||||
}
|
||||
curl_url_cleanup(uh);
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user