Discussion:
WinHttpQueryHeaders cannot query Cookie on Windows 7?
(too old to reply)
Jeff Guo
2009-11-17 23:04:02 UTC
Permalink
Our application uses WinHttpQueryHeaders to query the Cookie sent back by
server. It works well on XP (WinHttp 5.1) and Vista (WinHttp 6.0). However
the same code cannot work on Windows 7 (WinHttp 6.1).

WCHAR buffer[1024];
DWORD dwBuffSize = 1023, dwIndex = 0;
...... //call WinHttpOpen, WinHttpConnect, WinHttpSendRequest,
WinHttpReceiveResponse etc.

WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_COOKIE |
WINHTTP_QUERY_FLAG_REQUEST_HEADERS, WINHTTP_HEADER_NAME_BY_INDEX,
buffer, &dwBuffSize,
&dwIndex);

Any idea? Any help are appreciated.

Thanks,

Jeff
flytomysky
2009-12-06 00:32:01 UTC
Permalink
Post by Jeff Guo
Our application uses WinHttpQueryHeaders to query the Cookie sent back by
server. It works well on XP (WinHttp 5.1) and Vista (WinHttp 6.0). However
the same code cannot work on Windows 7 (WinHttp 6.1).
WCHAR buffer[1024];
DWORD dwBuffSize = 1023, dwIndex = 0;
...... //call WinHttpOpen, WinHttpConnect, WinHttpSendRequest,
WinHttpReceiveResponse etc.
WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_COOKIE |
WINHTTP_QUERY_FLAG_REQUEST_HEADERS, WINHTTP_HEADER_NAME_BY_INDEX,
buffer, &dwBuffSize,
&dwIndex);
Any idea? Any help are appreciated.
Thanks,
Jeff
i don't know why!
but this worked.

WCHAR buffer[1024];
DWORD dwBuffSize = 1023, dwIndex = 0;
WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_COOKIE ,
WINHTTP_HEADER_NAME_BY_INDEX, buffer, &dwBuffSize, &dwIndex);

Loading...