开发者

Don't send existing cookies, but still accept set cookies

开发者 https://www.devze.com 2023-03-27 23:31 出处:网络
I am looking at the Wininet APIs for cookies, and I cannot seem to find a flag for that would avoid sending cookies, but still accept them. I am trying to not send in the HTTP request the cookies curr

I am looking at the Wininet APIs for cookies, and I cannot seem to find a flag for that would avoid sending cookies, but still accept them. I am trying to not send in the HTTP request the cookies currently in the machine, but still let the set cookie from the server response be set (and override any existing cookies).

The closest flag is INTERNET_FLAG_NO_COOKIES, but that also does not add cookies to the cookie database:

INTERNET_FLAG_NO_COOKIES

0x00080000

Does not automa开发者_StackOverflow中文版tically add cookie headers to requests, and does not automatically add returned cookies to the cookie database. This flag can be used by HttpOpenRequest and InternetOpenUrl (for HTTP requests).


One bad solution I found is to iterate through the cached entries with FindFirstUrlCacheEntry, FindNextUrlCacheEntry and delete the entries associated with the URL with DeleteUrlCacheEntry every time before the request is sent.

0

精彩评论

暂无评论...
验证码 换一张
取 消