Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/winhttp/request.c | 26 ++++++++++++++++++++++++-- dlls/winhttp/tests/winhttp.c | 10 ++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 7ca2dfe864..e7c2184ab0 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -3185,8 +3185,30 @@ DWORD WINAPI WinHttpWebSocketClose( HINTERNET hsocket, USHORT status, void *reas DWORD WINAPI WinHttpWebSocketQueryCloseStatus( HINTERNET hsocket, USHORT *status, void *reason, DWORD len, DWORD *consumed ) { - FIXME("%p, %p, %p, %u, %p\n", hsocket, status, reason, len, consumed); - return ERROR_INVALID_PARAMETER; + struct socket *sock; + + FIXME("%p, %p, %p, %u, %p Semi-stub\n", hsocket, status, reason, len, consumed); + + if (!(sock = (struct socket *)grab_object( hsocket ))) + { + return ERROR_INVALID_HANDLE; + } + + if (sock->hdr.type != WINHTTP_HANDLE_TYPE_SOCKET) + { + ERR("Incorrect handle type\n"); + release_object( &sock->hdr ); + return ERROR_WINHTTP_INCORRECT_HANDLE_TYPE; + } + + if (reason) + *(char*)reason = 0; + *consumed = 0; + *status = WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS; + + release_object( &sock->hdr ); + + return NO_ERROR; }
enum request_state diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 44f156ba39..804d4fbca9 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -39,6 +39,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static DWORD (WINAPI *pWinHttpWebSocketClose)(HINTERNET,USHORT,void *,DWORD); static HINTERNET (WINAPI *pWinHttpWebSocketCompleteUpgrade)(HINTERNET,DWORD_PTR); +static DWORD (WINAPI *pWinHttpWebSocketQueryCloseStatus)(HINTERNET,USHORT*,void*,DWORD,DWORD*);
static BOOL proxy_active(void) { @@ -3104,6 +3105,7 @@ static void test_websocket(int port) WCHAR header[32]; char buf[128]; BOOL ret; + USHORT closestatus;
if (!pWinHttpWebSocketCompleteUpgrade) { @@ -3252,6 +3254,13 @@ static void test_websocket(int port) ret = pWinHttpWebSocketClose(socket, WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS, NULL, 0); ok(ret == NO_ERROR, "got %u\n", GetLastError());
+ size = sizeof(buf); + closestatus = WINHTTP_WEB_SOCKET_ABORTED_CLOSE_STATUS; + ret = pWinHttpWebSocketQueryCloseStatus(socket, &closestatus, NULL, 0, &size); + ok(ret == NO_ERROR, "got %u\n", GetLastError()); + ok(size == 0, "got %u\n", size); + ok(closestatus == WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS, "got %u\n", closestatus); + /* request handle is still valid */ size = sizeof(ctx); ret = WinHttpQueryOption(request, WINHTTP_OPTION_CONTEXT_VALUE, &ctx, &size); @@ -4948,6 +4957,7 @@ START_TEST (winhttp)
pWinHttpWebSocketClose = (void *)GetProcAddress(mod, "WinHttpWebSocketClose"); pWinHttpWebSocketCompleteUpgrade = (void *)GetProcAddress(mod, "WinHttpWebSocketCompleteUpgrade"); + pWinHttpWebSocketQueryCloseStatus = (void *)GetProcAddress(mod, "WinHttpWebSocketQueryCloseStatus");
test_WinHttpOpenRequest(); test_WinHttpSendRequest();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=74033
Your paranoid android.
=== w8 (32 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w8adm (32 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w1064v1507 (32 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w1064v1809 (32 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w1064v1809_2scr (32 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w1064v1809_ar (32 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w1064v1809_he (32 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w1064v1809_ja (32 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w1064v1809_zh_CN (32 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w864 (64 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w1064v1507 (64 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006
=== w1064v1809 (64 bit report) ===
winhttp: winhttp.c:3255: Test failed: got 0 winhttp.c:3260: Test failed: got 0 winhttp.c:3261: Test failed: got 128 winhttp.c:3262: Test failed: got 1006