curl/add_file_name_to_url: use the libcurl URL parser

instead of the custom error-prone parser, to extract and update the path
of the given URL

Closes #9683
This commit is contained in:
Daniel Stenberg 2022-10-10 10:55:05 +02:00
parent b82eb72d80
commit d24a2ffefe
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 62 additions and 52 deletions

View file

@ -1131,12 +1131,10 @@ static CURLcode single_transfer(struct GlobalConfig *global,
/*
* We have specified a file to upload and it isn't "-".
*/
char *nurl = add_file_name_to_url(per->this_url, per->uploadfile);
if(!nurl) {
result = CURLE_OUT_OF_MEMORY;
result = add_file_name_to_url(per->curl, &per->this_url,
per->uploadfile);
if(result)
break;
}
per->this_url = nurl;
}
else if(per->uploadfile && stdin_upload(per->uploadfile)) {
/* count to see if there are more than one auth bit set