Don't reuse credentials if redirected to a different host.

Submitted by:	Niels Heinen <heinenn@google.com>
MFC after:	3 weeks
This commit is contained in:
Dag-Erling Smørgrav 2012-04-30 12:12:48 +00:00
parent 30787285b5
commit f51b84bcc4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=234838

View File

@ -1779,7 +1779,9 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
DEBUG(fprintf(stderr, "failed to parse new URL\n"));
goto ouch;
}
if (!*new->user && !*new->pwd) {
/* Only copy credentials if the host matches */
if (!strcmp(new->host, url->host) && !*new->user && !*new->pwd) {
strcpy(new->user, url->user);
strcpy(new->pwd, url->pwd);
}