2020-11-26 16:25:44 -08:00
|
|
|
From 20e7de7c8f73fb27f7eeffbc5de646fc27fe1bb7 Mon Sep 17 00:00:00 2001
|
2015-05-15 18:00:35 -07:00
|
|
|
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
|
|
|
Date: Sat, 16 May 2015 00:24:35 +0200
|
2020-11-26 16:25:44 -08:00
|
|
|
Subject: [PATCH] wininet: Strip filename if no path is set in cookie.
|
2015-05-15 18:00:35 -07:00
|
|
|
|
|
|
|
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
|
2020-11-26 16:25:44 -08:00
|
|
|
index c770c312ba9..d95b39bd9ce 100644
|
2015-05-15 18:00:35 -07:00
|
|
|
--- a/dlls/wininet/http.c
|
|
|
|
+++ b/dlls/wininet/http.c
|
2020-11-26 16:25:44 -08:00
|
|
|
@@ -654,10 +654,18 @@ static void HTTP_ProcessCookies( http_request_t *request )
|
2015-05-15 18:00:35 -07:00
|
|
|
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;
|
|
|
|
+
|
2019-11-25 16:52:26 -08:00
|
|
|
+ tmp = wcsrchr(path, '/');
|
2015-05-15 18:00:35 -07:00
|
|
|
+ if (tmp && tmp[1]) tmp[1] = 0;
|
|
|
|
+
|
|
|
|
EnterCriticalSection( &request->headers_section );
|
|
|
|
|
2020-11-26 16:25:44 -08:00
|
|
|
while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, L"Set-Cookie", numCookies++, FALSE)) != -1)
|
|
|
|
@@ -676,10 +684,11 @@ static void HTTP_ProcessCookies( http_request_t *request )
|
2015-05-15 18:00:35 -07:00
|
|
|
|
2016-05-17 16:45:07 -07:00
|
|
|
name = substr(setCookieHeader->lpszValue, data - setCookieHeader->lpszValue);
|
2015-05-15 18:00:35 -07:00
|
|
|
data++;
|
2016-05-17 16:45:07 -07:00
|
|
|
- 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);
|
2015-05-15 18:00:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2020-11-26 16:25:44 -08:00
|
|
|
index 510c3ac5232..b98e648c276 100644
|
2015-05-15 18:00:35 -07:00
|
|
|
--- a/dlls/wininet/tests/http.c
|
|
|
|
+++ b/dlls/wininet/tests/http.c
|
2020-11-26 16:25:44 -08:00
|
|
|
@@ -2363,7 +2363,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
|
2015-05-15 18:00:35 -07:00
|
|
|
}
|
|
|
|
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);
|
2020-11-26 16:25:44 -08:00
|
|
|
@@ -3351,7 +3351,7 @@ static void test_header_override(int port)
|
2015-05-15 18:00:35 -07:00
|
|
|
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
|
|
ok(ret, "HttpSendRequest failed\n");
|
|
|
|
|
|
|
|
- test_status_code_todo(req, 200);
|
|
|
|
+ test_status_code(req, 200);
|
|
|
|
|
2015-06-25 07:37:32 -07:00
|
|
|
InternetCloseHandle(req);
|
2015-05-15 18:00:35 -07:00
|
|
|
req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
2020-11-26 16:25:44 -08:00
|
|
|
@@ -3360,7 +3360,7 @@ static void test_header_override(int port)
|
2015-05-15 18:00:35 -07:00
|
|
|
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
|
|
ok(ret, "HttpSendRequest failed\n");
|
|
|
|
|
|
|
|
- test_status_code_todo(req, 200);
|
|
|
|
+ test_status_code(req, 200);
|
|
|
|
|
2015-06-25 07:37:32 -07:00
|
|
|
InternetCloseHandle(req);
|
2015-05-15 18:00:35 -07:00
|
|
|
InternetSetCookieA("http://test.local", "foo", "bar");
|
|
|
|
--
|
2020-11-26 16:25:44 -08:00
|
|
|
2.29.2
|
2015-05-15 18:00:35 -07:00
|
|
|
|