Hans Leidekker : wininet: Replace any existing cookie header.
Alexandre Julliard
julliard at winehq.org
Fri Apr 24 10:00:12 CDT 2009
Module: wine
Branch: master
Commit: 8ab00329dd90994da581b39c0de1c8c434a6cde7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8ab00329dd90994da581b39c0de1c8c434a6cde7
Author: Hans Leidekker <hans at codeweavers.com>
Date: Fri Apr 24 15:00:05 2009 +0200
wininet: Replace any existing cookie header.
---
dlls/wininet/http.c | 2 +-
dlls/wininet/tests/http.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 8d03b61..3bda535 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3227,7 +3227,7 @@ static void HTTP_InsertCookies(LPWININETHTTPREQW lpwhr)
InternetGetCookieW(lpszUrl, NULL, lpszCookies + cnt, &nCookieSize);
strcatW(lpszCookies, szCrLf);
- HTTP_HttpAddRequestHeadersW(lpwhr, lpszCookies, strlenW(lpszCookies), HTTP_ADDREQ_FLAG_ADD);
+ HTTP_HttpAddRequestHeadersW(lpwhr, lpszCookies, strlenW(lpszCookies), HTTP_ADDREQ_FLAG_REPLACE);
HeapFree(GetProcessHeap(), 0, lpszCookies);
}
}
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 773b4c6..bb701b0 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -1885,6 +1885,15 @@ static void test_cookie_header(int port)
ok(!ret, "HttpQueryInfo succeeded\n");
ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "got %u expected ERROR_HTTP_HEADER_NOT_FOUND\n", error);
+ ret = HttpAddRequestHeaders(req, "Cookie: cookie=not biscuit\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD);
+ ok(ret, "HttpAddRequestHeaders failed: %u\n", GetLastError());
+
+ buffer[0] = 0;
+ size = sizeof(buffer);
+ ret = HttpQueryInfo(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+ ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
+ ok(!strcmp(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer);
+
ret = HttpSendRequest(req, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
More information about the wine-cvs
mailing list