mirror of
https://github.com/curl/curl.git
synced 2026-07-24 18:47:18 +03:00
url: normalize CURLINFO_EFFECTIVE_URL
The URL extracted with CURLINFO_EFFECTIVE_URL was returned as given as input in most cases, which made it not get a scheme prefixed like before if the URL was given without one, and it didn't remove dotdot sequences etc. Added test case 1907 to verify that this now works as intended and as before 7.62.0. Regression introduced in 7.62.0 Reported-by: Christophe Dervieux Fixes #4491 Closes #4493
This commit is contained in:
parent
347075bc17
commit
e062043433
5 changed files with 123 additions and 2 deletions
10
lib/url.c
10
lib/url.c
|
|
@ -1792,6 +1792,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
if(!data->set.uh) {
|
||||
char *newurl;
|
||||
uc = curl_url_set(uh, CURLUPART_URL, data->change.url,
|
||||
CURLU_GUESS_SCHEME |
|
||||
CURLU_NON_SUPPORT_SCHEME |
|
||||
|
|
@ -1802,6 +1803,15 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
|
|||
DEBUGF(infof(data, "curl_url_set rejected %s\n", data->change.url));
|
||||
return Curl_uc_to_curlcode(uc);
|
||||
}
|
||||
|
||||
/* after it was parsed, get the generated normalized version */
|
||||
uc = curl_url_get(uh, CURLUPART_URL, &newurl, 0);
|
||||
if(uc)
|
||||
return Curl_uc_to_curlcode(uc);
|
||||
if(data->change.url_alloc)
|
||||
free(data->change.url);
|
||||
data->change.url = newurl;
|
||||
data->change.url_alloc = TRUE;
|
||||
}
|
||||
|
||||
uc = curl_url_get(uh, CURLUPART_SCHEME, &data->state.up.scheme, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue