请求报文
一个HTTP请求报文由请求行(request line)、请求头部(header)、空行和请求数据4个部分组成,下图给出了请求报文的一般格式。- GET http://test.com/ask.asp?name=liyang HTTP/1.1
- Accept: */*
- Accept-Language: zh-cn
- Accept-Encoding: gzip, deflate
- User-Agent: Mozilla/4.0 (compatible; MSIE 6.0;
- Windows NT 5.1; SV1; .NET CLR 2.0.50727)
- Host: www.test.com
- Connection: Keep-Alive
复制代码 HTTP响应报文
HTTP响应也由三个部分组成,分别是:状态行、消息报头、响应正文。- HTTP/1.1 200 OK
- Connection: keep-alive
- Date: Thu, 26 Jul 2010 14:00:02 GMT
- Server: Microsoft-IIS/6.0
- X-Powered-By: ASP.NET
- Content-Length: 280
- Content-Type: text/html
- Set-Cookie: ASPSESSIONIDSAATTCSQ=JOPPKDCAMHHBEOICJPGPBJOB; path=/
- Cache-control: private
- <html>
- <head>
- <title>一网精深</title>
- </head>
- <body>
- <b>HTTP响应报文<br></b>
- <b>测试<br></b>
- </body>
- </html>
复制代码 |