抓包分析: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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>Demo2.html</h1>
</body>
</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 :定時刷新/定時跳轉.
* 響應體:顯示瀏覽器的頁面的內容.