mirror of
https://github.com/curl/curl.git
synced 2026-08-25 19:33:32 +03:00
transfer: clear credentials when redirecting to absolute URL
Make sure the user and password for the second request is taken from the redirected-to URL. Add test case 899 to verify. Reported-by: James Lucas Fixes #11410 Closes #11412
This commit is contained in:
parent
def99e011e
commit
dd4d1a2695
4 changed files with 91 additions and 24 deletions
|
|
@ -1554,10 +1554,15 @@ CURLcode Curl_follow(struct Curl_easy *data,
|
|||
|
||||
if((type != FOLLOW_RETRY) &&
|
||||
(data->req.httpcode != 401) && (data->req.httpcode != 407) &&
|
||||
Curl_is_absolute_url(newurl, NULL, 0, FALSE))
|
||||
Curl_is_absolute_url(newurl, NULL, 0, FALSE)) {
|
||||
/* If this is not redirect due to a 401 or 407 response and an absolute
|
||||
URL: don't allow a custom port number */
|
||||
disallowport = TRUE;
|
||||
if(!data->set.allow_auth_to_other_hosts) {
|
||||
Curl_safefree(data->state.aptr.user);
|
||||
Curl_safefree(data->state.aptr.passwd);
|
||||
}
|
||||
}
|
||||
|
||||
DEBUGASSERT(data->state.uh);
|
||||
uc = curl_url_set(data->state.uh, CURLUPART_URL, newurl,
|
||||
|
|
|
|||
|
|
@ -1864,7 +1864,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
|
|||
* User name and password set with their own options override the
|
||||
* credentials possibly set in the URL.
|
||||
*/
|
||||
if(!data->state.aptr.passwd) {
|
||||
if(!data->set.str[STRING_PASSWORD]) {
|
||||
uc = curl_url_get(uh, CURLUPART_PASSWORD, &data->state.up.password, 0);
|
||||
if(!uc) {
|
||||
char *decoded;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue