POST /02_WEB_HTTP/index.html HTTP/1.1
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*
Referer: http://localhost:8080/02_WEB_HTTP/form.html
Accept-Language: zh-CN,en-US;q=0.7,ko-KR;q=0.3
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: localhost:8080
Content-Length: 30
Connection: Keep-Alive
Cache-Control: no-cache
username=admin&password=123123
post請求報文:
請求首行
POST /02_WEB_HTTP/index.html HTTP/1.1
請求方式 請求路徑 協議名/協議版本
請求頭
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*
Referer: http://localhost:8080/02_WEB_HTTP/form.html
Accept-Language: zh-CN,en-US;q=0.7,ko-KR;q=0.3
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3)
Content-Type: application/x-www-form-urlencoded
指的是請求體中的內容類型:application/x-www-form-urlencoded指請求體中的內容將會使用URL編碼
username=%E5%AD%99%E6%82%9F%E7%A9%BA
當發送中文參數時,我們需要將字符轉換為二進制編碼來發送
url編碼指的是,將字符轉換為二進制編碼,然后在將二進制轉換為十六進制
發送請求參數時以十六進制編碼的形式發送
Accept-Encoding: gzip, deflate
Host: localhost:8080
Content-Length: 30
請求體的長度:
Connection: Keep-Alive
Cache-Control: no-cache
緩存的管理:no-cache不使用緩存
空行
空行的作用就是分割請求首部和請求體
請求體
username=admin&password=123123
post請求通過請求體來發送請求參數
轉載請注明出處!
http://www.cnblogs.com/libingbin/
感謝您的閱讀。如果文章對您有用,那么請輕輕點個贊,以資鼓勵。