Zebediah Figura : httpapi: Implement HttpReceiveHttpRequest().

Alexandre Julliard julliard at winehq.org
Wed Aug 28 18:23:20 CDT 2019


Module: wine
Branch: master
Commit: 7ed2d587938cfabc536bbd3516fe4aea00255394
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7ed2d587938cfabc536bbd3516fe4aea00255394

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Aug 27 16:43:01 2019 -0500

httpapi: Implement HttpReceiveHttpRequest().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/httpapi/httpapi_main.c | 40 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c
index 5f2a307..08fbe4d 100644
--- a/dlls/httpapi/httpapi_main.c
+++ b/dlls/httpapi/httpapi_main.c
@@ -250,9 +250,43 @@ ULONG WINAPI HttpRemoveUrl(HANDLE queue, const WCHAR *urlW)
 ULONG WINAPI HttpReceiveHttpRequest(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags,
         HTTP_REQUEST *request, ULONG size, ULONG *ret_size, OVERLAPPED *ovl)
 {
-    FIXME("queue %p, id %s, flags %#x, request %p, size %#x, ret_size %p, ovl %p, stub!\n",
-          queue, wine_dbgstr_longlong(id), flags, request, size, ret_size, ovl);
-    return ERROR_CALL_NOT_IMPLEMENTED;
+    struct http_receive_request_params params =
+    {
+        .addr = (ULONG_PTR)request,
+        .id = id,
+        .flags = flags,
+        .bits = sizeof(void *) * 8,
+    };
+    ULONG ret = ERROR_SUCCESS;
+    OVERLAPPED sync_ovl;
+
+    TRACE("queue %p, id %s, flags %#x, request %p, size %#x, ret_size %p, ovl %p.\n",
+            queue, wine_dbgstr_longlong(id), flags, request, size, ret_size, ovl);
+
+    if (flags & ~HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY)
+        FIXME("Ignoring flags %#x.\n", flags & ~HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY);
+
+    if (size < sizeof(HTTP_REQUEST_V1))
+        return ERROR_INSUFFICIENT_BUFFER;
+
+    if (!ovl)
+    {
+        sync_ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
+        ovl = &sync_ovl;
+    }
+
+    if (!DeviceIoControl(queue, IOCTL_HTTP_RECEIVE_REQUEST, &params, sizeof(params), request, size, NULL, ovl))
+        ret = GetLastError();
+
+    if (ovl == &sync_ovl)
+    {
+        ret = ERROR_SUCCESS;
+        if (!GetOverlappedResult(queue, ovl, ret_size, TRUE))
+            ret = GetLastError();
+        CloseHandle(sync_ovl.hEvent);
+    }
+
+    return ret;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list