wine-staging/patches/wininet-Cleanup/0008-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch
2015-06-25 16:37:32 +02:00

84 lines
2.8 KiB
Diff

From b5601ae74c8c528a2c636587a7b8678dfb717b5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 16 May 2015 00:24:35 +0200
Subject: 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.
---
dlls/wininet/http.c | 11 ++++++++++-
dlls/wininet/tests/http.c | 6 +++---
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index edea9f8..f7c8f76 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -764,10 +764,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 = strrchrW(path, '/');
+ if (tmp && tmp[1]) tmp[1] = 0;
+
EnterCriticalSection( &request->headers_section );
while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, szSet_Cookie, numCookies++, FALSE)) != -1)
@@ -789,11 +797,12 @@ static void HTTP_ProcessCookies( http_request_t *request )
continue;
data++;
- set_cookie(request->server->name, request->path, name, data, INTERNET_COOKIE_HTTPONLY);
+ set_cookie(request->server->name, path, name, data, INTERNET_COOKIE_HTTPONLY);
heap_free(name);
}
LeaveCriticalSection( &request->headers_section );
+ heap_free(path);
}
static void strip_spaces(LPWSTR start)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 1a82aba..ff76e9f 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -2217,7 +2217,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);
@@ -3159,7 +3159,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);
@@ -3168,7 +3168,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");
--
2.4.3