Xbox servers reject PUT requests without Content-length header.
-- v2: winhttp: Always send Content-length with PUT.
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..b7deaea324a 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 (verb && !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=126158
Your paranoid android.
=== w10pro64_ar (testbot log) ===
WineRunTask.pl:error: The previous 1 run(s) terminated abnormally
=== 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
Report validation errors: advapi32:security has no test summary line (early exit of the main process?) advapi32:security has unaccounted for todo messages
This merge request was approved by Hans Leidekker.