wininet: Correctly handle redirects to non-http URLs.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-05-31 16:03:57 +02:00 committed by Alexandre Julliard
parent 48716cba98
commit 9c959154f6
1 changed files with 9 additions and 0 deletions

View File

@ -3993,7 +3993,16 @@ static WCHAR *get_redirect_url(http_request_t *request)
return NULL;
}
urlComponents.dwSchemeLength = 1;
b = InternetCrackUrlW(redirect_url, url_length, 0, &urlComponents);
if(b && urlComponents.dwSchemeLength &&
urlComponents.nScheme != INTERNET_SCHEME_HTTP && urlComponents.nScheme != INTERNET_SCHEME_HTTPS) {
TRACE("redirect to non-http URL\n");
return NULL;
}
urlComponents.lpszScheme = (request->hdr.dwFlags & INTERNET_FLAG_SECURE) ? szHttps : szHttp;
urlComponents.dwSchemeLength = 0;
urlComponents.lpszHostName = request->server->name;
urlComponents.nPort = request->server->port;
urlComponents.lpszUserName = session->userName;