wininet: Replace any existing cookie header.

This commit is contained in:
Hans Leidekker 2009-04-24 15:00:05 +02:00 committed by Alexandre Julliard
parent fbc99515eb
commit 8ab00329dd
2 changed files with 10 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -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());