Commit 57955c73 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard
Browse files

winhttp: Allow custom headers to be separated by any sequence of \r and \n.

This fixes connecting to multiplayer game servers in Riptide GP: Renegade.
parent cba0d5c5
......@@ -467,26 +467,14 @@ DWORD add_request_headers( struct request *request, const WCHAR *headers, DWORD
p = buffer;
do
{
q = p;
while (*q)
{
if (q[0] == '\n' && q[1] == '\r')
{
q[0] = '\r';
q[1] = '\n';
}
if (q[0] == '\r') break;
q++;
}
if (!*p) break;
if (*q == '\r')
{
*q = 0;
if (q[1] == '\n')
q += 2; /* jump over \r\n */
else
q++; /* jump over \r */
}
for (q = p; *q && *q != '\r' && *q != '\n'; ++q)
;
*q++ = 0;
while (*q == '\r' || *q == '\n')
++q;
if ((header = parse_header( p )))
{
ret = process_header( request, header->field, header->value, flags, TRUE );
......
......@@ -2532,8 +2532,8 @@ static DWORD CALLBACK server_thread(LPVOID param)
if (strstr(buffer, "POST /bad_headers"))
{
ok(!!strstr(buffer, "Content-Type: text/html\r\n"), "Header missing from request %s.\n", debugstr_a(buffer));
todo_wine ok(!!strstr(buffer, "Test1: Value1\r\n"), "Header missing from request %s.\n", debugstr_a(buffer));
todo_wine ok(!!strstr(buffer, "Test2: Value2\r\n"), "Header missing from request %s.\n", debugstr_a(buffer));
ok(!!strstr(buffer, "Test1: Value1\r\n"), "Header missing from request %s.\n", debugstr_a(buffer));
ok(!!strstr(buffer, "Test2: Value2\r\n"), "Header missing from request %s.\n", debugstr_a(buffer));
ok(!!strstr(buffer, "Test3: Value3\r\n"), "Header missing from request %s.\n", debugstr_a(buffer));
ok(!!strstr(buffer, "Test4: Value4\r\n"), "Header missing from request %s.\n", debugstr_a(buffer));
ok(!!strstr(buffer, "Test5: Value5\r\n"), "Header missing from request %s.\n", debugstr_a(buffer));
......@@ -3654,13 +3654,10 @@ static void test_bad_header( int port )
len = sizeof(buffer);
ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
header_tests[i].header, buffer, &len, &index );
todo_wine_if (i >= 1 && i <= 3)
{
ok( ret, "header %s: failed to query headers %lu\n", debugstr_w(header_tests[i].header), GetLastError() );
ok( !wcscmp( buffer, header_tests[i].value ), "header %s: got %s\n",
debugstr_w(header_tests[i].header), debugstr_w(buffer) );
ok( index == 1, "header %s: index = %lu\n", debugstr_w(header_tests[i].header), index );
}
ok( ret, "header %s: failed to query headers %lu\n", debugstr_w(header_tests[i].header), GetLastError() );
ok( !wcscmp( buffer, header_tests[i].value ), "header %s: got %s\n",
debugstr_w(header_tests[i].header), debugstr_w(buffer) );
ok( index == 1, "header %s: index = %lu\n", debugstr_w(header_tests[i].header), index );
}
ret = WinHttpSendRequest( req, L"Test5: Value5\rTest6: Value6", ~0u, NULL, 0, 0, 0 );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment