请求行:
格式: 请求方式 资源路径 HTTP版本号
例如: GET /test.html HTTP/1.1
请求方式有: POST,HEAD,OPTIONS,DELETE,PUT
状态行:
格式: HTTP版本号 状态吗 原因描述
例如: HTTP/1.1 200 OK
实例:用telnet请求apache服务器:
>telnet localhost 80 回车
>ctrl+] 回车
>GEG /index.php HTTP/1.0 两个回车
HTTP/1.1 200 OK
Date: Wed, 13 Jul 2011 14:25:37 GMT
Server: Apache/2.2.8 (Win32) PHP/6.0.0-dev
Last-Modified: Wed, 13 Jul 2011 14:02:56 GMT
ETag: "f0000000101ef-8-4a7f3df920d68"
Accept-Ranges: bytes
Content-Length: 8
Connection: close
Content-Type: text/html
新建网页
失去了跟主机的连接。
>GEG /index.php HTTP/1.1 两个回车
HTTP/1.1 400 Bad Request
Date: Wed, 13 Jul 2011 14:27:07 GMT
Server: Apache/2.2.8 (Win32) PHP/6.0.0-dev
Content-Length: 319
Connection: close
Content-Type: text/html; charset=iso-8859-1
400 Bad Req
uest Bad Request
Your browser sent a request that
this server could not understand.
Apache/2.2.8 (Win32) PH
P/6.0.0-dev Server at Port 80
失去了跟主机的连接。
>GEG /index.php HTTP/1.1 回车
>Host: 两个回车
HTTP/1.1 200 OK
Date: Wed, 13 Jul 2011 14:29:16 GMT
Server: Apache/2.2.8 (Win32) PHP/6.0.0-dev
Last-Modified: Wed, 13 Jul 2011 14:02:56 GMT
ETag: "f0000000101ef-8-4a7f3df920d68"
Accept-Ranges: bytes
Content-Length: 8
Content-Type: text/html
新建网页 //注意:此时连接并没有立即断开,还可以继续发送请求消息
GET /a.html //简单的请求消息:不需要版本信息,返回后立即断开连接.
新建网页
失去了跟主机的连接。
阅读(648) | 评论(0) | 转发(0) |