wininet: Moved WORKREQ_HTTPSENDREQUESTW out of WORKREQUEST.

This commit is contained in:
Jacek Caban 2013-01-28 11:23:19 +01:00 committed by Alexandre Julliard
parent 63e6a4b2e1
commit 940a67c8a5
2 changed files with 41 additions and 50 deletions

View File

@ -4930,23 +4930,32 @@ lend:
return res; return res;
} }
typedef struct {
task_header_t hdr;
WCHAR *headers;
DWORD headers_len;
void *optional;
DWORD optional_len;
DWORD content_len;
BOOL end_request;
} send_request_task_t;
/*********************************************************************** /***********************************************************************
* *
* Helper functions for the HttpSendRequest(Ex) functions * Helper functions for the HttpSendRequest(Ex) functions
* *
*/ */
static void AsyncHttpSendRequestProc(WORKREQUEST *workRequest) static void AsyncHttpSendRequestProc(task_header_t *hdr)
{ {
struct WORKREQ_HTTPSENDREQUESTW const *req = &workRequest->u.HttpSendRequestW; send_request_task_t *task = (send_request_task_t*)hdr;
http_request_t *request = (http_request_t*) workRequest->hdr; http_request_t *request = (http_request_t*)task->hdr.hdr;
TRACE("%p\n", request); TRACE("%p\n", request);
HTTP_HttpSendRequestW(request, req->lpszHeader, HTTP_HttpSendRequestW(request, task->headers, task->headers_len, task->optional,
req->dwHeaderLength, req->lpOptional, req->dwOptionalLength, task->optional_len, task->content_len, task->end_request);
req->dwContentLength, req->bEndRequest);
heap_free(req->lpszHeader); heap_free(task->headers);
} }
@ -5211,11 +5220,9 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST *task; send_request_task_t *task;
struct WORKREQ_HTTPSENDREQUESTW *req;
task = alloc_async_task(&request->hdr, AsyncHttpSendRequestProc, sizeof(*task)); task = alloc_async_task(&request->hdr, AsyncHttpSendRequestProc, sizeof(*task));
req = &task->u.HttpSendRequestW;
if (lpBuffersIn) if (lpBuffersIn)
{ {
DWORD size = 0; DWORD size = 0;
@ -5227,31 +5234,28 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
else else
size = lpBuffersIn->dwHeadersLength * sizeof(WCHAR); size = lpBuffersIn->dwHeadersLength * sizeof(WCHAR);
req->lpszHeader = heap_alloc(size); task->headers = heap_alloc(size);
memcpy( req->lpszHeader, lpBuffersIn->lpcszHeader, size ); memcpy(task->headers, lpBuffersIn->lpcszHeader, size);
} }
else req->lpszHeader = NULL; else task->headers = NULL;
req->dwHeaderLength = size / sizeof(WCHAR); task->headers_len = size / sizeof(WCHAR);
req->lpOptional = lpBuffersIn->lpvBuffer; task->optional = lpBuffersIn->lpvBuffer;
req->dwOptionalLength = lpBuffersIn->dwBufferLength; task->optional_len = lpBuffersIn->dwBufferLength;
req->dwContentLength = lpBuffersIn->dwBufferTotal; task->content_len = lpBuffersIn->dwBufferTotal;
} }
else else
{ {
req->lpszHeader = NULL; task->headers = NULL;
req->dwHeaderLength = 0; task->headers_len = 0;
req->lpOptional = NULL; task->optional = NULL;
req->dwOptionalLength = 0; task->optional_len = 0;
req->dwContentLength = 0; task->content_len = 0;
} }
req->bEndRequest = FALSE; task->end_request = FALSE;
INTERNET_AsyncCall(task); INTERNET_AsyncCall(&task->hdr);
/*
* This is from windows.
*/
res = ERROR_IO_PENDING; res = ERROR_IO_PENDING;
} }
else else
@ -5317,11 +5321,9 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST *task; send_request_task_t *task;
struct WORKREQ_HTTPSENDREQUESTW *req;
task = alloc_async_task(&request->hdr, AsyncHttpSendRequestProc, sizeof(*task)); task = alloc_async_task(&request->hdr, AsyncHttpSendRequestProc, sizeof(*task));
req = &task->u.HttpSendRequestW;
if (lpszHeaders) if (lpszHeaders)
{ {
DWORD size; DWORD size;
@ -5329,18 +5331,18 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
if (dwHeaderLength == ~0u) size = (strlenW(lpszHeaders) + 1) * sizeof(WCHAR); if (dwHeaderLength == ~0u) size = (strlenW(lpszHeaders) + 1) * sizeof(WCHAR);
else size = dwHeaderLength * sizeof(WCHAR); else size = dwHeaderLength * sizeof(WCHAR);
req->lpszHeader = heap_alloc(size); task->headers = heap_alloc(size);
memcpy(req->lpszHeader, lpszHeaders, size); memcpy(task->headers, lpszHeaders, size);
} }
else else
req->lpszHeader = 0; task->headers = NULL;
req->dwHeaderLength = dwHeaderLength; task->headers_len = dwHeaderLength;
req->lpOptional = lpOptional; task->optional = lpOptional;
req->dwOptionalLength = dwOptionalLength; task->optional_len = dwOptionalLength;
req->dwContentLength = dwOptionalLength; task->content_len = dwOptionalLength;
req->bEndRequest = TRUE; task->end_request = TRUE;
INTERNET_AsyncCall(task); INTERNET_AsyncCall(&task->hdr);
res = ERROR_IO_PENDING; res = ERROR_IO_PENDING;
} }
else else

View File

@ -427,16 +427,6 @@ struct WORKREQ_FTPFINDNEXTW
LPWIN32_FIND_DATAW lpFindFileData; LPWIN32_FIND_DATAW lpFindFileData;
}; };
struct WORKREQ_HTTPSENDREQUESTW
{
LPWSTR lpszHeader;
DWORD dwHeaderLength;
LPVOID lpOptional;
DWORD dwOptionalLength;
DWORD dwContentLength;
BOOL bEndRequest;
};
struct WORKREQ_HTTPENDREQUESTW struct WORKREQ_HTTPENDREQUESTW
{ {
DWORD dwFlags; DWORD dwFlags;
@ -488,7 +478,6 @@ typedef struct WORKREQ
struct WORKREQ_FTPREMOVEDIRECTORYW FtpRemoveDirectoryW; struct WORKREQ_FTPREMOVEDIRECTORYW FtpRemoveDirectoryW;
struct WORKREQ_FTPRENAMEFILEW FtpRenameFileW; struct WORKREQ_FTPRENAMEFILEW FtpRenameFileW;
struct WORKREQ_FTPFINDNEXTW FtpFindNextW; struct WORKREQ_FTPFINDNEXTW FtpFindNextW;
struct WORKREQ_HTTPSENDREQUESTW HttpSendRequestW;
struct WORKREQ_HTTPENDREQUESTW HttpEndRequestW; struct WORKREQ_HTTPENDREQUESTW HttpEndRequestW;
struct WORKREQ_SENDCALLBACK SendCallback; struct WORKREQ_SENDCALLBACK SendCallback;
struct WORKREQ_INTERNETOPENURLW InternetOpenUrlW; struct WORKREQ_INTERNETOPENURLW InternetOpenUrlW;