Module: wine Branch: master Commit: e6ab87ccfa78cffae5bcbe2c1dfc58b5ef7fb2ac URL: http://source.winehq.org/git/wine.git/?a=commit;h=e6ab87ccfa78cffae5bcbe2c1d...
Author: Hans Leidekker hans@codeweavers.com Date: Tue Dec 18 11:22:50 2012 +0100
winhttp: Check the server response when downloading a PAC script.
---
dlls/winhttp/session.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 3889922..8a5c457 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -1939,7 +1939,7 @@ static BSTR download_script( const WCHAR *url ) HINTERNET ses, con = NULL, req = NULL; WCHAR *hostname; URL_COMPONENTSW uc; - DWORD size = 4096, offset, to_read, bytes_read, flags = 0; + DWORD status, size = sizeof(status), offset, to_read, bytes_read, flags = 0; char *tmp, *buffer = NULL; BSTR script = NULL; int len; @@ -1956,8 +1956,12 @@ static BSTR download_script( const WCHAR *url ) if (uc.nScheme == INTERNET_SCHEME_HTTPS) flags |= WINHTTP_FLAG_SECURE; if (!(req = WinHttpOpenRequest( con, NULL, uc.lpszUrlPath, NULL, NULL, acceptW, flags ))) goto done; if (!WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 )) goto done; + if (!(WinHttpReceiveResponse( req, 0 ))) goto done; + if (!WinHttpQueryHeaders( req, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, + &size, NULL ) || status != HTTP_STATUS_OK) goto done;
+ size = 4096; if (!(buffer = heap_alloc( size ))) goto done; to_read = size; offset = 0;