Xbox servers reject PUT requests without Content-length header.
From: Paul Gofman pgofman@codeweavers.com
--- dlls/winhttp/request.c | 2 +- dlls/winhttp/tests/winhttp.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 64f70b61a96..e046b05581c 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -2185,7 +2185,7 @@ static DWORD send_request( struct request *request, const WCHAR *headers, DWORD if (request->creds[TARGET_SERVER][SCHEME_BASIC].username) do_authorization( request, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC );
- if (total_len || (request->verb && !wcscmp( request->verb, L"POST" ))) + if (total_len || (request->verb && (!wcscmp( request->verb, L"POST" ) || !wcscmp( request->verb, L"PUT" )))) { WCHAR length[21]; /* decimal long int + null */ swprintf( length, ARRAY_SIZE(length), L"%ld", total_len ); diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 45eaf1a673a..17f0841dd1b 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -2541,6 +2541,11 @@ static DWORD CALLBACK server_thread(LPVOID param) ok(!!strstr(buffer, "Cookie: 111\r\n"), "Header missing from request %s.\n", debugstr_a(buffer)); send(c, okmsg, sizeof(okmsg) - 1, 0); } + if (strstr(buffer, "PUT /test")) + { + ok(!!strstr(buffer, "Content-Length: 0\r\n"), "Header missing from request %s.\n", debugstr_a(buffer)); + send(c, okmsg, sizeof(okmsg) - 1, 0); + } shutdown(c, 2); closesocket(c); c = -1; @@ -2633,8 +2638,15 @@ static void test_basic_request(int port, const WCHAR *verb, const WCHAR *path) memset(buffer, 0, sizeof(buffer)); ret = WinHttpReadData(req, buffer, sizeof buffer, &count); ok(ret, "failed to read data %lu\n", GetLastError()); - ok(count == sizeof page1 - 1, "count was wrong\n"); - ok(!memcmp(buffer, page1, sizeof page1), "http data wrong\n"); + if (!wcscmp(verb, L"PUT")) + { + ok(!count, "got count %ld\n", count); + } + else + { + ok(count == sizeof page1 - 1, "got count %ld\n", count); + ok(!memcmp(buffer, page1, sizeof page1), "http data wrong\n"); + }
WinHttpCloseHandle(req); WinHttpCloseHandle(con); @@ -5795,7 +5807,6 @@ START_TEST (winhttp) test_WinHttpGetProxyForUrl(); test_chunked_read(); test_max_http_automatic_redirects(); - si.event = CreateEventW(NULL, 0, 0, NULL); si.port = 7532;
@@ -5809,10 +5820,10 @@ START_TEST (winhttp) CloseHandle(thread); return; } - test_IWinHttpRequest(si.port); test_connection_info(si.port); test_basic_request(si.port, NULL, L"/basic"); + test_basic_request(si.port, L"PUT", L"/test"); test_no_headers(si.port); test_no_content(si.port); test_head_request(si.port);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126156
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
winhttp: 054c:winhttp: unhandled exception c0000005 at 7605D3C7
=== w7u_adm (32 bit report) ===
winhttp: 0860:winhttp: unhandled exception c0000005 at 760FD3C7
=== w7u_el (32 bit report) ===
winhttp: 09f0:winhttp: unhandled exception c0000005 at 76C5D3C7
=== w8 (32 bit report) ===
winhttp: 0980:winhttp: unhandled exception c0000005 at 76E8B9A0
=== w8adm (32 bit report) ===
winhttp: 0a9c:winhttp: unhandled exception c0000005 at 76D7B9A0
=== w864 (32 bit report) ===
winhttp: 0bf4:winhttp: unhandled exception c0000005 at 7729B9A0
=== w1064v1507 (32 bit report) ===
winhttp: 0be0:winhttp: unhandled exception c0000005 at 74C29A80
=== w1064v1809 (32 bit report) ===
winhttp: 1d34:winhttp: unhandled exception c0000005 at 7603B6F0
=== w1064 (32 bit report) ===
winhttp: 1ccc:winhttp: unhandled exception c0000005 at 7683A280
=== w1064_tsign (32 bit report) ===
winhttp: 0c14:winhttp: unhandled exception c0000005 at 76EEA280
=== w10pro64 (32 bit report) ===
winhttp: 1d8c:winhttp: unhandled exception c0000005 at 777FA280
=== w864 (64 bit report) ===
winhttp: 0b38:winhttp: unhandled exception c0000005 at 00007FFDCD6E2EF4
=== w1064v1507 (64 bit report) ===
winhttp: 0c30:winhttp: unhandled exception c0000005 at 00007FFFDF4ED2F4
=== w1064v1809 (64 bit report) ===
winhttp: 1d38:winhttp: unhandled exception c0000005 at 00007FFAD161E393
=== w1064 (64 bit report) ===
winhttp: 1d7c:winhttp: unhandled exception c0000005 at 00007FFEE3A0DF63
=== w1064_2qxl (64 bit report) ===
winhttp: 0008:winhttp: unhandled exception c0000005 at 00007FF8F532DF63
=== w1064_adm (64 bit report) ===
winhttp: 1cec:winhttp: unhandled exception c0000005 at 00007FFAE70CDF63
=== w1064_tsign (64 bit report) ===
winhttp: 10c4:winhttp: unhandled exception c0000005 at 00007FFED51EDF63
=== w10pro64 (64 bit report) ===
winhttp: 1e44:winhttp: unhandled exception c0000005 at 00007FFCF144DF63
=== w10pro64_en_AE_u8 (64 bit report) ===
winhttp: 1c94:winhttp: unhandled exception c0000005 at 00007FF99DD2DF63
=== w10pro64_ar (64 bit report) ===
winhttp: 1e3c:winhttp: unhandled exception c0000005 at 00007FFC518FDF63
=== w10pro64_ja (64 bit report) ===
winhttp: 1ce0:winhttp: unhandled exception c0000005 at 00007FFA4141DF63
=== w10pro64_zh_CN (64 bit report) ===
winhttp: 2084:winhttp: unhandled exception c0000005 at 00007FFD3B64DF63
=== debian11 (32 bit report) ===
crypt32: cert.c:4191: Test failed: success cert.c:4192: Test failed: got 00000000 cert.c:4193: Test failed: got 00000000
winhttp: Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x656eae9a).
=== debian11 (32 bit ar:MA report) ===
winhttp: Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x656eae9a).
=== debian11 (32 bit de report) ===
winhttp: Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x656eae9a).
=== debian11 (32 bit fr report) ===
winhttp: Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x656eae9a).
=== debian11 (32 bit he:IL report) ===
winhttp: Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x656eae9a).
=== debian11 (32 bit hi:IN report) ===
winhttp: Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x656eae9a).
=== debian11 (32 bit ja:JP report) ===
winhttp: Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x656eae9a).
=== debian11 (32 bit zh:CN report) ===
winhttp: Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x656eae9a).
=== debian11b (32 bit WoW report) ===
winhttp: Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x656eae9a).
=== debian11b (64 bit WoW report) ===
winhttp: Unhandled exception: page fault on read access to 0x0000000000000000 in 64-bit code (0x000000695e56d8).