抓包分析:GET方式:
* 请求部分:
GET /day09/demo1-http/demo2.html?name=aaa&age=23 HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
X-HttpWatch-RID: 59176-10011
Referer: http://localhost:8080/day09/demo1-http/demo1.html
Accept-Language: zh-CN
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Host: localhost:8080
DNT: 1
Connection: Keep-Alive
抓包分析:POST方式:
POST /day09/demo1-http/demo2.html HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
X-HttpWatch-RID: 59176-10031
Referer: http://localhost:8080/day09/demo1-http/demo1.html
Accept-Language: zh-CN
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: localhost:8080
Content-Length: 15
DNT: 1
Connection: Keep-Alive
Cache-Control: no-cache
name=bbb&age=38
* 响应部分:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Accept-Ranges: bytes
ETag: W/"145-1461807615933"
Last-Modified: Thu, 28 Apr 2016 01:40:15 GMT
Content-Type: text/html
Content-Length: 145
Date: Thu, 28 Apr 2016 01:43:52 GMT
Insert title here
Demo2.html
Ø 请求部分
* 请求行
* 提交方式:
* 提交方式有很多,常用的GET和POST:
* GET和POST的区别:
* GET的提交的参数会显示到地址栏上,而POST不显示.
* GET往往是有大小限制的,而POST没有大小的限制.
* GET没有请求体,而POST有请求体.
* 提交路径:
* 协议版本:
* 请求头
* 都是键值对的形式显示的.一般一个key对应一个value,也有个别的是一个key对应多个value.
* User-Agent :代表浏览器的类型. --- 文件下载:下载中文文件:IE使用URLEncodor进行编码,而Firefox使用Base64编码.
* Referer :代表的是网页的来源.--- 防盗链.
* If-Modified-Since :通常与响应中的头Last-Modified一起使用查找本地缓存.
* 请求体
* 就是POST提交方式的提交的参数.
Ø 响应部分
* 响应行:
* 协议版本
* 状态码 :
* 200 :成功
* 302 :重定向
* 304 :查找本地缓存
* 404 :资源不存在
* 500 :服务器内部错误
* 状态码描述
* 响应头:键值对,一般一个key对应一个value,也有一个key对应多个value.
* Last-Modified :与请求中的If-Modified-Since一起使用查找本地缓存.
* Content-Dispostion :文件下载的使用使用的一个头信息.
* Location :重定向的跳转的路径.
* Refresh :定时刷新/定时跳转.
* 响应体:显示浏览器的页面的内容.