[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: [PATCH v2 4/5] httpapi: Wait for overlapped I/O completion only if ERROR_IO_PENDING is returned.
From: Zebediah Figura <z.figura12 () gmail ! com>
Date: 2020-02-29 3:45:31
Message-ID: 20200229034532.360255-4-z.figura12 () gmail ! com
[Download RAW message or body]
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/httpapi/httpapi_main.c | 21 ++++++++++++++-------
dlls/httpapi/tests/httpapi.c | 9 +++++++++
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c
index 6143214346..9904ed18db 100644
--- a/dlls/httpapi/httpapi_main.c
+++ b/dlls/httpapi/httpapi_main.c
@@ -304,13 +304,17 @@ ULONG WINAPI HttpReceiveRequestEntityBody(HANDLE queue, \
HTTP_REQUEST_ID id, ULON ovl = &sync_ovl;
}
- if (!DeviceIoControl(queue, IOCTL_HTTP_RECEIVE_BODY, ¶ms, sizeof(params), \
buffer, size, NULL, ovl)) + if (!DeviceIoControl(queue, IOCTL_HTTP_RECEIVE_BODY, \
¶ms, sizeof(params), buffer, size, ret_size, ovl)) ret = GetLastError();
if (ovl == &sync_ovl)
{
- if (!GetOverlappedResult(queue, ovl, ret_size, TRUE))
- ret = GetLastError();
+ if (ret == ERROR_IO_PENDING)
+ {
+ ret = ERROR_SUCCESS;
+ if (!GetOverlappedResult(queue, ovl, ret_size, TRUE))
+ ret = GetLastError();
+ }
CloseHandle(sync_ovl.hEvent);
}
@@ -348,14 +352,17 @@ ULONG WINAPI HttpReceiveHttpRequest(HANDLE queue, \
HTTP_REQUEST_ID id, ULONG flag ovl = &sync_ovl;
}
- if (!DeviceIoControl(queue, IOCTL_HTTP_RECEIVE_REQUEST, ¶ms, sizeof(params), \
request, size, NULL, ovl)) + if (!DeviceIoControl(queue, \
IOCTL_HTTP_RECEIVE_REQUEST, ¶ms, sizeof(params), request, size, ret_size, ovl)) \
ret = GetLastError();
if (ovl == &sync_ovl)
{
- ret = ERROR_SUCCESS;
- if (!GetOverlappedResult(queue, ovl, ret_size, TRUE))
- ret = GetLastError();
+ if (ret == ERROR_IO_PENDING)
+ {
+ ret = ERROR_SUCCESS;
+ if (!GetOverlappedResult(queue, ovl, ret_size, TRUE))
+ ret = GetLastError();
+ }
CloseHandle(sync_ovl.hEvent);
}
diff --git a/dlls/httpapi/tests/httpapi.c b/dlls/httpapi/tests/httpapi.c
index 252a712a96..099c951e9d 100644
--- a/dlls/httpapi/tests/httpapi.c
+++ b/dlls/httpapi/tests/httpapi.c
@@ -188,6 +188,9 @@ static void test_v1_server(void)
ret = CloseHandle(queue2);
ok(ret, "Failed to close queue handle, error %u.\n", GetLastError());
+ ret_size = 0xdeadbeef;
+ ret = HttpReceiveHttpRequest(NULL, HTTP_NULL_ID, 0, (HTTP_REQUEST *)req, \
sizeof(req_buffer), &ret_size, NULL); + ok(ret == ERROR_INVALID_HANDLE, "Got error \
%u.\n", ret);
ret = HttpReceiveHttpRequest(NULL, HTTP_NULL_ID, 0, (HTTP_REQUEST *)req, \
sizeof(req_buffer), NULL, &ovl); ok(ret == ERROR_INVALID_HANDLE, "Got error %u.\n", \
ret);
ret = HttpReceiveHttpRequest(queue, 0xdeadbeef, 0, (HTTP_REQUEST *)req, \
sizeof(req_buffer), NULL, &ovl); @@ -791,6 +794,12 @@ static void \
test_v1_entity_body(void)
/* Test HttpReceiveRequestEntityBody(). */
+ ret_size = 0xdeadbeef;
+ ret = HttpReceiveRequestEntityBody(NULL, HTTP_NULL_ID, 0, recv_body, \
sizeof(recv_body), &ret_size, NULL); + ok(ret == ERROR_INVALID_HANDLE, "Got error \
%u.\n", ret); + ret = HttpReceiveRequestEntityBody(NULL, HTTP_NULL_ID, 0, \
recv_body, sizeof(recv_body), NULL, &ovl); + ok(ret == ERROR_INVALID_HANDLE, "Got \
error %u.\n", ret); +
sprintf(req_text, post_req, port);
ret = send(s, req_text, strlen(req_text) + 1, 0);
ok(ret == strlen(req_text) + 1, "send() returned %d.\n", ret);
--
2.25.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic