Chinaunix
标题:
http 接收问题
[打印本页]
作者:
wishrr
时间:
2010-10-13 00:40
标题:
http 接收问题
这个是我对于字符串的连接:
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);
output(buf);
抓包也是和输入的顺序是一样的,但是就是在解析不了,
读取的数据就是 Cookie: username=ss
还请各位高人指点一下
作者:
zzyong08
时间:
2010-10-13 09:30
回复
1#
wishrr
你的意思是,你这样拼出的HTTP请求,服务端不认,是吗?
GET 请求,还差一个空行,也就是说,你的请求还差一个\r\n。
作者:
davelv
时间:
2010-10-13 09:36
HTTP消息(不算正文)最后是两个\r\n才可以~
作者:
wishrr
时间:
2010-10-13 13:00
谢谢了!太感谢了!
作者:
wishrr
时间:
2010-10-13 13:02
哥们,谢了!
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2