Commit 7158474f authored by Timo Teräs's avatar Timo Teräs

libfetch: keep http auth only if redirect is for the same host

fixes #10688
parent dac30d50
Pipeline #51693 passed with stage
in 41 seconds
......@@ -1070,7 +1070,13 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
/* XXX should set an error code */
goto ouch;
}
if (!*new->user && !*new->pwd) {
if (!new->port)
new->port = fetch_default_port(url->scheme);
if (!new->user[0] && !new->pwd[0] &&
new->port == url->port &&
strcmp(new->scheme, url->scheme) == 0 &&
strcmp(new->host, url->host) == 0) {
/* keep auth if staying on same host */
strcpy(new->user, url->user);
strcpy(new->pwd, url->pwd);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment