From 69d123ae2547edb8b80d013fe6e2ecd3bf3a8b47 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 20 Jan 2018 13:56:09 +0100 Subject: [PATCH] [WINHTTP_WINETEST] Sync with Wine 3.0. CORE-14225 --- .../rostests/winetests/winhttp/notification.c | 6 +- modules/rostests/winetests/winhttp/winhttp.c | 71 ++++++++++++++++++- 2 files changed, 72 insertions(+), 5 deletions(-) diff --git a/modules/rostests/winetests/winhttp/notification.c b/modules/rostests/winetests/winhttp/notification.c index 79f6b8c9356..bcb7a0b318d 100644 --- a/modules/rostests/winetests/winhttp/notification.c +++ b/modules/rostests/winetests/winhttp/notification.c @@ -944,7 +944,7 @@ static void _read_request_data(struct test_request *req, struct info *info, cons WaitForSingleObject( info->wait, INFINITE ); len = strlen(expected_data); - ok(!memcmp(buffer, expected_data, len), "unexpeceted data\n"); + ok(!memcmp(buffer, expected_data, len), "unexpected data\n"); } static void test_persistent_connection(int port) @@ -1033,14 +1033,16 @@ START_TEST (notification) ret = WaitForSingleObject( si.event, 10000 ); ok(ret == WAIT_OBJECT_0, "failed to start winhttp test server %u\n", GetLastError()); if (ret != WAIT_OBJECT_0) + { + CloseHandle(thread); return; + } #ifdef __REACTOS__ if (!winetest_interactive) { skip("Skipping test_persistent_connection due to hang. See ROSTESTS-295.\n"); } -else #endif test_persistent_connection( si.port ); diff --git a/modules/rostests/winetests/winhttp/winhttp.c b/modules/rostests/winetests/winhttp/winhttp.c index 8b2b601ba60..d9024dfb7d8 100644 --- a/modules/rostests/winetests/winhttp/winhttp.c +++ b/modules/rostests/winetests/winhttp/winhttp.c @@ -326,7 +326,7 @@ static void test_SendRequest (void) static CHAR post_data[] = "mode=Test"; static const char test_post[] = "mode => Test\0\n"; HINTERNET session, request, connection; - DWORD header_len, optional_len, total_len, bytes_rw, size, err; + DWORD header_len, optional_len, total_len, bytes_rw, size, err, disable; DWORD_PTR context; BOOL ret; CHAR buffer[256]; @@ -357,6 +357,12 @@ static void test_SendRequest (void) ret = WinHttpSetOption(request, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(context)); ok(ret, "WinHttpSetOption failed: %u\n", GetLastError()); + /* writing more data than promised by the content-length header causes an error when the connection + is resued, so disable keep-alive */ + disable = WINHTTP_DISABLE_KEEP_ALIVE; + ret = WinHttpSetOption(request, WINHTTP_OPTION_DISABLE_FEATURE, &disable, sizeof(disable)); + ok(ret, "WinHttpSetOption failed: %u\n", GetLastError()); + context++; ret = WinHttpSendRequest(request, content_type, header_len, post_data, optional_len, total_len, context); err = GetLastError(); @@ -575,7 +581,7 @@ static void test_WinHttpAddHeaders(void) SetLastError(0xdeadbeef); ret = WinHttpAddRequestHeaders(request, test_headers[0], -1L, WINHTTP_ADDREQ_FLAG_ADD); err = GetLastError(); - ok(ret, "WinHttpAddRequestHeader failed to add new header, got %d with error %u.\n", ret, err); + ok(ret, "WinHttpAddRequestHeaders failed to add new header, got %d with error %u.\n", ret, err); ok(err == ERROR_SUCCESS || broken(err == 0xdeadbeef) /* < win7 */, "got %u\n", err); index = 0; @@ -981,7 +987,7 @@ static void test_secure_connection(void) { static const char data_start[] = "