Module: wine Branch: master Commit: 8e37ed551a15146980e7092820d9c5f526237897 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8e37ed551a15146980e7092820...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Jun 10 14:47:16 2011 +0200
wininet: Don't pass handle to INTERNET_REQUEST_COMPLETE unless the request is opened via InternetPoenUrl.
---
dlls/wininet/http.c | 17 +++++++++++------ dlls/wininet/tests/http.c | 1 + 2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 21c4125..520d17c 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2660,7 +2660,7 @@ static void HTTP_ReceiveRequestData(http_request_t *req, BOOL first_notif) }
if(res == ERROR_SUCCESS) - send_request_complete(req, (DWORD_PTR)req->hdr.hInternet, avail); + send_request_complete(req, req->session->hdr.dwInternalFlags & INET_OPENURL ? (DWORD_PTR)req->hdr.hInternet : 1, avail); else send_request_complete(req, 0, res); } @@ -4805,10 +4805,15 @@ lend:
if (request->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) { - if (res == ERROR_SUCCESS && request->contentLength && request->bytesWritten == request->bytesToWrite) - HTTP_ReceiveRequestData(request, TRUE); - else - send_request_complete(request, res == ERROR_SUCCESS ? (DWORD_PTR)request->hdr.hInternet : 0, res); + if (res == ERROR_SUCCESS) { + if(request->contentLength && request->bytesWritten == request->bytesToWrite) + HTTP_ReceiveRequestData(request, TRUE); + else + send_request_complete(request, + request->session->hdr.dwInternalFlags & INET_OPENURL ? (DWORD_PTR)request->hdr.hInternet : 1, 0); + }else { + send_request_complete(request, 0, res); + } }
TRACE("<--\n"); @@ -4902,7 +4907,7 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_ if (res == ERROR_SUCCESS && request->contentLength) HTTP_ReceiveRequestData(request, TRUE); else - send_request_complete(request, res == ERROR_SUCCESS ? (DWORD_PTR)request->hdr.hInternet : 0, res); + send_request_complete(request, res == ERROR_SUCCESS, res);
return res; } diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 5db7f64..13ac6f5 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -287,6 +287,7 @@ static VOID WINAPI callback( ok(dwStatusInformationLength == sizeof(INTERNET_ASYNC_RESULT), "info length should be sizeof(INTERNET_ASYNC_RESULT) instead of %d\n", dwStatusInformationLength); + ok(iar->dwResult == 1 || iar->dwResult == 0, "iar->dwResult = %ld\n", iar->dwResult); trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REQUEST_COMPLETE {%ld,%d} %d\n", GetCurrentThreadId(), hInternet, dwContext, iar->dwResult,iar->dwError,dwStatusInformationLength);