Signed-off-by: Haoyang Chen chenhaoyang@uniontech.com --- dlls/winhttp/request.c | 7 +++++-- dlls/winhttp/tests/winhttp.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 946168786ae..a6c16d7b653 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -378,14 +378,17 @@ DWORD add_request_headers( struct request *request, const WCHAR *headers, DWORD q[0] = '\r'; q[1] = '\n'; } - if (q[0] == '\r' && q[1] == '\n') break; + if (q[0] == '\r') break; q++; } if (!*p) break; if (*q == '\r') { *q = 0; - q += 2; /* jump over \r\n */ + if (q[1] == '\n') + q += 2; /* jump over \r\n */ + else + q++; /* jump over \r */ } if ((header = parse_header( p ))) { diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 56f35252615..60204f6536f 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -3480,7 +3480,7 @@ static void test_bad_header( int port ) req = WinHttpOpenRequest( con, NULL, NULL, NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() );
- ret = WinHttpAddRequestHeaders( req, L"Content-Type: text/html\n\r", ~0u, WINHTTP_ADDREQ_FLAG_ADD ); + ret = WinHttpAddRequestHeaders( req, L"Content-Type: text/html\n\rContent-Length:6\rCookie:111", ~0u, WINHTTP_ADDREQ_FLAG_ADD ); ok( ret, "failed to add header %u\n", GetLastError() );
index = 0; @@ -3492,6 +3492,15 @@ static void test_bad_header( int port ) ok( !lstrcmpW( buffer, L"text/html" ), "got %s\n", wine_dbgstr_w(buffer) ); ok( index == 1, "index = %u\n", index );
+ index = 0; + buffer[0] = 0; + len = sizeof(buffer); + ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_CUSTOM|WINHTTP_QUERY_FLAG_REQUEST_HEADERS, + L"Cookie", buffer, &len, &index ); + ok( ret, "failed to query headers %u\n", GetLastError() ); + ok( !lstrcmpW( buffer, L"111" ), "got %s\n", wine_dbgstr_w(buffer) ); + ok( index == 1, "index = %u\n", index ); + WinHttpCloseHandle( req ); WinHttpCloseHandle( con ); WinHttpCloseHandle( ses );
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=94663
Your paranoid android.
=== w8adm (32 bit report) ===
winhttp: winhttp.c:301: Test failed: WinHttpSendRequest failed: 12007 winhttp.c:302: Test failed: got 12007 winhttp.c:407: Test failed: WinHttpSendRequest failed: 12007 winhttp.c:427: Test failed: Expected ERROR_INVALID_PARAMETER got 12019. winhttp.c:427: Test failed: Expected ERROR_INVALID_PARAMETER got 12019. winhttp.c:427: Test failed: Expected ERROR_INVALID_PARAMETER got 12019. winhttp.c:427: Test failed: Expected ERROR_INVALID_PARAMETER got 12019. winhttp.c:427: Test failed: Expected ERROR_INVALID_PARAMETER got 12019. winhttp.c:427: Test failed: Expected ERROR_INVALID_PARAMETER got 12019. winhttp.c:434: Test failed: Expected ERROR_SUCCESS got 12019. winhttp.c:436: Test failed: WinHttpReceiveResponse failed: 12019. winhttp.c:440: Test failed: got 12019 winhttp.c:448: Test failed: WinHttpReadData failed: 12019. winhttp.c:450: Test failed: Read 4294967295 bytes winhttp.c:451: Test failed: Data read did not match.