毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> linux >> 正文

Your browser sent a request that this server could not understand

更新时间:2013-8-23:  来源:毕业论文

linux下,用C写了一个SOCKET向服务器发送了一个HTTP的请求,(static const char* request = "GET /index.html HTTP/1.1\r\n\r\n";)这个只是试验,结果服务器发回的
HTTP/1.1 400 Bad Request
Date: Wed, 21 Aug 2013 08:59:32 GMT
Server: Apache/2.2.24 (Unix)
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1

后面还有一个
Your browser sent a request that this server could not understand

这个应该是GET的格式问题吧,我用wireshark抓访问百度的包,一个GET包有挺多行内容的:
GET / HTTP/1.1\r\n
Host: www.youerw.com \r\n
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:23.0) Gecko/20100101 Firefox/23.0\r\n
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n
Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3\r\n
Accept-Encoding: gzip, deflate\r\n
Cookie: BAIDUID=A21FE77A3E5A4A8B26A82120C14E891B:FG=1; CNZZDATA30081939=cnzz_eid%3D941235294-1376885338-http%253A%252F%252Fwww.baidu.com%26ntime%3D1376885338%26cnzz_a%3D0%26retime%3D1376885338015%26sin%3D%26ltime%3D1376885338015%26rtime%3D0; BDREFER=%7Burl%3A%22http%3A//mil.news.baidu.com/%22%2Cword%3A%22%22%7D; H_PS_PSSID=3157_2777_1429_3139_2785_2981_3092_3108_2701\r\n
Connection: keep-alive\r\n\r\n
我把这个内容发过去,成功收到回复:
HTTP/1.1 200 OK
Date: Thu, 22 Aug 2013 02:56:52 GMT
Server: BWS/1.0
Content-Length: 4491
Content-Type: text/html;charset=utf-8
Cache-Control: private
BDPAGETYPE: 1
BDUSERID: 0
BDQID: 0xac102fc8007bef3a
Set-Cookie: BDSVRTM=2; path=/
Set-Cookie: H_PS_PSSID=3157_2777_1429_3139_2785_2981_3092_3108_2701; path=/; domain=.baidu.com
Expires: Thu, 22 Aug 2013 02:56:52 GMT
Content-Encoding: gzip
Connection: Keep-Alive

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。