diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 8d03b61cfe..3bda5354fa 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 773b4c6652..bb701b024b 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());