3、头信息(消息头)
Accept: text/html,image/* 客户端识别文件类型
Accept-Charset: ISO-8859-1 客户端字符集
Accept-Encoding: gzip 客户端支持编码类型 gzip 压缩格式
Accept-Language:zh-cn 客户端语言
Host: www.itcast.com:80 访问服务器地址
Referer: http://www.itcast.com/index.jsp (重要) 防止盗链
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) 浏览器类型(文件下载时,不同浏览器进行不同处理)
Connection: close/Keep-Alive 请求后连接是关闭还是保持
Date: Tue, 11 Jul 2010 18:23:51 GMT 请求时间
重点:If-Modified-Since、referer
referer:当浏览器向web服务器发送请求的时候,一般会带上Referer,告诉服务器我是从那个页面链接过来的,服务器籍此可以获得一些信息处理.
在Http中Last-Modified与If-Modified-Since都是用于记录页面最后修改时间的HTTP头信息,注意,在这Last-Modified是由服务器往客户端发送Http头,
If-Modified-Since是由客户端往服务器发送的头,通过时间判断客户端页面是否是最新的.
4、请求体(只存在于请求方式为post的情况下)
多个数据之间用&分隔
请求头:
Accept: text/html,image/*(浏览器可以接收的类型)
Accept-Charset: ISO-8859-1(浏览器可以接收的编码类型)
Accept-Encoding: gzip,compress(浏览器可以接收压缩编码类型)
Accept-Language: en-us,zh-cn(浏览器可以接收的语言和国家类型)
Host: www.it315.org:80(浏览器请求的主机和端口)
If-Modified-Since: Tue, 11 Jul 2000 18:23:51 GMT(某个页面缓存时间)
Referer: http://www.it315.org/index.jsp(请求来自于哪个页面)
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)(浏览器相关信息)
Cookie:(浏览器暂存服务器发送的信息)
Connection: close(1.0)/Keep-Alive(1.1)(HTTP请求的版本的特点)
Date: Tue, 11 Jul 2000 18:23:51 GMT(请求网站的时间)
响应头:
Location: http://www.it315.org/index.jsp(控制浏览器显示哪个页面)
Server:apache tomcat(服务器的类型)
Content-Encoding: gzip(服务器发送的压缩编码方式)
Content-Length: 80(服务器发送显示的字节码长度)
Content-Language: zh-cn(服务器发送内容的语言和国家名)
Content-Type: image/jpeg; charset=UTF-8(服务器发送内容的类型和编码类型)
Last-Modified: Tue, 11 Jul 2000 18:23:51 GMT(服务器最后一次修改的时间)
Refresh: 1;url=http://www.it315.org(控制浏览器1秒钟后转发URL所指向的页面)
Content-Disposition: attachment; filename=aaa.jpg(服务器控制浏览器发下载方式打开文件)
Transfer-Encoding: chunked(服务器分块传递数据到客户端)
Set-Cookie:SS=Q0=5Lb_nQ; path=/search(服务器发送Cookie相关的信息)
Expires: -1(服务器控制浏览器不要缓存网页,默认是缓存)
Cache-Control: no-cache(服务器控制浏览器不要缓存网页)
Pragma: no-cache(服务器控制浏览器不要缓存网页)
Connection: close/Keep-Alive(HTTP请求的版本的特点)
Date: Tue, 11 Jul 2000 18:23:51 GMT(响应网站的时间)