在线等,马上揭帖给分,为什么pFile->QueryInfo(HTTP_QUERY_SET_COOKIE, str) 只返回第一个Set-Cookie: ?

tony_w2000 2005-06-23 05:13:14
在线等,为什么pFile->QueryInfo(HTTP_QUERY_SET_COOKIE, str) 只返回第一个Set-Cookie: ?

------------------------
CString str;
pFile->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF, str);
TRACE(str+_T("\n\n"));

明明看到返回headers中有3个Set-Cookie:

HTTP/1.0 200 OK
Set-Cookie: cedr=1d456; expires=Monday, 17-Mar-08 09:00:32 GMT
Set-Cookie: wab=123; expires=Friday, 23-Jun-06 02:00:40 GMT; path=/;
Set-Cookie: cjkd=2123; expires=Friday, 23-Jun-06 02:00:40 GMT

为什么我用

pFile->QueryInfo(HTTP_QUERY_SET_COOKIE, str);
TRACE(str+_T("\n\n"));

只能显示cedr=1d456; expires=Monday, 17-Mar-08 09:00:32 GMT

其它2个呢??高手求救
...全文
420 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
tony_w2000 2005-06-29
  • 打赏
  • 举报
回复
非常感谢。给分揭帖 :)
qrlvls 2005-06-24
  • 打赏
  • 举报
回复
BOOL bSucc;
DOWRD dwVal;
DWORD i = 0;

do
{
dwVal = i;
bSucc = pFile->QueryInfo(HTTP_QUERY_SET_COOKIE, str, &dwVal);
TRACE(str+_T("\n\n"));
i ++;
}
while (bSucc);
qrlvls 2005-06-24
  • 打赏
  • 举报
回复
BOOL CHttpFile::QueryInfo(DWORD dwInfoLevel, CString& str, LPDWORD lpdwIndex) const

lpdwIndex 是一个 IN OUT 参数,你需要尝试多个赋值
lpdwIndex
[in, out] Pointer to a zero-based header index used to enumerate multiple headers with the same name. When calling the function, this parameter is the index of the specified header to return. When the function returns, this parameter is the index of the next header. If the next index cannot be found, ERROR_HTTP_HEADER_NOT_FOUND is returned.
saliors 2005-06-24
  • 打赏
  • 举报
回复
不懂,关注一下。

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧