Module: wine Branch: master Commit: 9c959154f62840f2c8de45f2a082d5793ae1ece4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9c959154f62840f2c8de45f2a0...
Author: Jacek Caban jacek@codeweavers.com Date: Wed May 31 16:03:57 2017 +0200
wininet: Correctly handle redirects to non-http URLs.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wininet/http.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 2172f5f..17a1919 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -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;