[PATCH 3/7] winhttp: Fix dwResult field in websocket receive error result.
Paul Gofman
wine at gitlab.winehq.org
Mon Jun 6 23:02:31 CDT 2022
From: Paul Gofman <pgofman at codeweavers.com>
---
dlls/winhttp/request.c | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 70d727c7e2e..29887c8d7d0 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -3839,6 +3839,25 @@ static DWORD socket_receive( struct socket *socket, void *buf, DWORD len, DWORD
return ret;
}
+static void socket_receive_complete( struct socket *socket, DWORD ret, WINHTTP_WEB_SOCKET_BUFFER_TYPE type, DWORD len )
+{
+ if (!ret)
+ {
+ WINHTTP_WEB_SOCKET_STATUS status;
+ status.dwBytesTransferred = len;
+ status.eBufferType = type;
+ send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, &status, sizeof(status) );
+ }
+ else
+ {
+ WINHTTP_WEB_SOCKET_ASYNC_RESULT result;
+ result.AsyncResult.dwResult = 0;
+ result.AsyncResult.dwError = ret;
+ result.Operation = WINHTTP_WEB_SOCKET_RECEIVE_OPERATION;
+ send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) );
+ }
+}
+
static void task_socket_receive( void *ctx )
{
struct socket_receive *r = ctx;
@@ -3850,23 +3869,7 @@ static void task_socket_receive( void *ctx )
ret = socket_receive( socket, r->buf, r->len, &count, &type );
if (receive_io_complete( socket ))
- {
- if (!ret)
- {
- WINHTTP_WEB_SOCKET_STATUS status;
- status.dwBytesTransferred = count;
- status.eBufferType = type;
- send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, &status, sizeof(status) );
- }
- else
- {
- WINHTTP_WEB_SOCKET_ASYNC_RESULT result;
- result.AsyncResult.dwResult = API_READ_DATA;
- result.AsyncResult.dwError = ret;
- result.Operation = WINHTTP_WEB_SOCKET_RECEIVE_OPERATION;
- send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) );
- }
- }
+ socket_receive_complete( socket, ret, type, count );
}
DWORD WINAPI WinHttpWebSocketReceive( HINTERNET hsocket, void *buf, DWORD len, DWORD *ret_len,
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/195
More information about the wine-devel
mailing list