Commit ca39a55e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Don't use INTERNET_ReadFile in HTTP_DrainContent.

parent 352b4212
......@@ -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 };
......
......@@ -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;
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment