免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: wishrr
打印 上一主题 下一主题

[C] 网络HTTP头协议解析问题 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2010-10-12 22:11 |只看该作者
我是用c写的:

snprintf(buf, BUFFER_SIZE, "GET %s?%s=%s.3322.org&%s=%s&username=%s&password=%s HTTP/1.1\015\012", request,"hostname",host,"wildcard",wildcard ? "ON" : "OFF",user_name,password);
  output(buf);
  snprintf(buf,BUFFER_SIZE,"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\015\012");
  output(buf);
  snprintf(buf,BUFFER_SIZE,"Accept-Language: zh-cn\015\012");
  output(buf);
  snprintf(buf,BUFFER_SIZE,"Accept-Encoding: gzip, deflate\015\012");
  output(buf);
  snprintf(buf,BUFFER_SIZE,"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 360SE)\015\012");       
  output(buf);
  snprintf(buf,BUFFER_SIZE,"Host: %s\015\012",server);
  output(buf);
  snprintf(buf,BUFFER_SIZE,"Connection: Keep-Alive\015\012");
  output(buf);
  snprintf(buf,BUFFER_SIZE,"Authorization: Basic d2lzaGVzMTIzOjE5OTA3Mg==\015\012");
  output(buf);
  snprintf(buf, BUFFER_SIZE,"Cookie: username=%s;\015\012",user_name);

我按格式发出内容,抓包也是一样的,但再读取的时候是 Cookie: username=%s 这样的请求内容 ,根本就没有解析出内容
    怎么回事?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP