Module: wine Branch: master Commit: ca39a55e88bac180b573d1cfab21dc01e1d8626d URL: http://source.winehq.org/git/wine.git/?a=commit;h=ca39a55e88bac180b573d1cfab...
Author: Jacek Caban jacek@codeweavers.com Date: Sun Mar 2 19:55:04 2008 +0100
wininet: Don't use INTERNET_ReadFile in HTTP_DrainContent.
---
dlls/wininet/http.c | 42 +++++++++++++++++++++--------------------- dlls/wininet/internet.c | 2 +- dlls/wininet/internet.h | 3 --- 3 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 40070fb..eafec2b 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -117,7 +117,7 @@ static BOOL WINAPI HTTP_HttpQueryInfoW( LPWININETHTTPREQW lpwhr, DWORD static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl); static UINT HTTP_DecodeBase64(LPCWSTR base64, LPSTR bin); static BOOL HTTP_VerifyValidHeader(LPWININETHTTPREQW lpwhr, LPCWSTR field); - +static void HTTP_DrainContent(WININETHTTPREQW *req);
LPHTTPHEADERW HTTP_GetHeader(LPWININETHTTPREQW req, LPCWSTR head) { @@ -715,25 +715,6 @@ BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest, return r; }
-/* read any content returned by the server so that the connection can be - * reused */ -static void HTTP_DrainContent(LPWININETHTTPREQW lpwhr) -{ - DWORD bytes_read; - - if (!NETCON_connected(&lpwhr->netConnection)) return; - - if (lpwhr->dwContentLength == -1) - NETCON_close(&lpwhr->netConnection); - - do - { - char buffer[2048]; - if (!INTERNET_ReadFile(&lpwhr->hdr, buffer, sizeof(buffer), &bytes_read, TRUE)) - return; - } while (bytes_read); -} - /*********************************************************************** * HttpEndRequestA (WININET.@) * @@ -1410,7 +1391,7 @@ static DWORD HTTPREQ_SetOption(WININETHANDLEHEADER *hdr, DWORD option, void *buf return ERROR_INTERNET_INVALID_OPTION; }
-DWORD HTTPREQ_Read(WININETHTTPREQW *req, void *buffer, DWORD size, DWORD *read, BOOL sync) +static DWORD HTTPREQ_Read(WININETHTTPREQW *req, void *buffer, DWORD size, DWORD *read, BOOL sync) { int bytes_read;
@@ -1692,6 +1673,25 @@ lend: return handle; }
+/* read any content returned by the server so that the connection can be + * reused */ +static void HTTP_DrainContent(WININETHTTPREQW *req) +{ + DWORD bytes_read; + + if (!NETCON_connected(&req->netConnection)) return; + + if (req->dwContentLength == -1) + NETCON_close(&req->netConnection); + + do + { + char buffer[2048]; + if (HTTPREQ_Read(req, buffer, sizeof(buffer), &bytes_read, TRUE) != ERROR_SUCCESS) + return; + } while (bytes_read); +} + static const WCHAR szAccept[] = { 'A','c','c','e','p','t',0 }; static const WCHAR szAccept_Charset[] = { 'A','c','c','e','p','t','-','C','h','a','r','s','e','t', 0 }; static const WCHAR szAccept_Encoding[] = { 'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0 }; diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index b60e175..c0709e6 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1700,7 +1700,7 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, }
-BOOL INTERNET_ReadFile(LPWININETHANDLEHEADER lpwh, LPVOID lpBuffer, +static BOOL INTERNET_ReadFile(LPWININETHANDLEHEADER lpwh, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead, BOOL bWait) { BOOL retval = FALSE; diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 509fd70..8f81c13 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -378,9 +378,6 @@ DWORD INTERNET_GetLastError(void); BOOL INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest); LPSTR INTERNET_GetResponseBuffer(void); LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen); -BOOL INTERNET_ReadFile(LPWININETHANDLEHEADER lpwh, LPVOID lpBuffer, - DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead, - BOOL bWait);
BOOLAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength,