redirect: when following redirects to an absolute URL, URL encode it

... to make it handle for example (RFC violating) embeded spaces.

Reported-by: momala454 on github
Fixes #4445
Closes #4447
This commit is contained in:
Daniel Stenberg 2019-10-01 09:54:21 +02:00
parent 2c20109a9b
commit c6f250c4d6
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 78 additions and 1 deletions

View file

@ -1591,7 +1591,8 @@ CURLcode Curl_follow(struct Curl_easy *data,
DEBUGASSERT(data->state.uh);
uc = curl_url_set(data->state.uh, CURLUPART_URL, newurl,
(type == FOLLOW_FAKE) ? CURLU_NON_SUPPORT_SCHEME : 0);
(type == FOLLOW_FAKE) ? CURLU_NON_SUPPORT_SCHEME :
((type == FOLLOW_REDIR) ? CURLU_URLENCODE : 0) );
if(uc) {
if(type != FOLLOW_FAKE)
return Curl_uc_to_curlcode(uc);