Commit b191a4e1 authored by Michael Müller's avatar Michael Müller Committed by Vitaly Lipatov

wininet: Strip filename if no path is set in cookie.

The order of the stored cookies doesn't match in /testC, so be a bit less strict in the test.
parent 547d00b2
......@@ -652,10 +652,18 @@ static void HTTP_ProcessCookies( http_request_t *request )
int HeaderIndex;
int numCookies = 0;
LPHTTPHEADERW setCookieHeader;
WCHAR *path, *tmp;
if(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES)
return;
path = heap_strdupW(request->path);
if (!path)
return;
tmp = wcsrchr(path, '/');
if (tmp && tmp[1]) tmp[1] = 0;
EnterCriticalSection( &request->headers_section );
while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, L"Set-Cookie", numCookies++, FALSE)) != -1)
......@@ -674,10 +682,11 @@ static void HTTP_ProcessCookies( http_request_t *request )
name = substr(setCookieHeader->lpszValue, data - setCookieHeader->lpszValue);
data++;
set_cookie(substrz(request->server->name), substrz(request->path), name, substrz(data), INTERNET_COOKIE_HTTPONLY);
set_cookie(substrz(request->server->name), substrz(path), name, substrz(data), INTERNET_COOKIE_HTTPONLY);
}
LeaveCriticalSection( &request->headers_section );
heap_free(path);
}
static void strip_spaces(LPWSTR start)
......
......@@ -2365,7 +2365,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
}
if (strstr(buffer, "/testC"))
{
if (strstr(buffer, "Cookie: cookie=biscuit"))
if (strstr(buffer, "cookie=biscuit"))
send(c, okmsg, sizeof okmsg-1, 0);
else
send(c, notokmsg, sizeof notokmsg-1, 0);
......@@ -3393,7 +3393,7 @@ static void test_header_override(int port)
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed\n");
test_status_code_todo(req, 200);
test_status_code(req, 200);
InternetCloseHandle(req);
req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
......@@ -3402,7 +3402,7 @@ static void test_header_override(int port)
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed\n");
test_status_code_todo(req, 200);
test_status_code(req, 200);
InternetCloseHandle(req);
InternetSetCookieA("http://test.local", "foo", "bar");
......
Markdown is supported
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