HTTP請求格式和HTTP響應格式

TIME__FLY發表於2018-07-25
HTTP請求格式
"GET {} HTTP/1.1\r\nhost: {}\r\nConnection\r\n\r\n".format(path, host)
 

 

 
Request Header
GET / HTTP/1.1
Host: www.baidu.com
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: pgv_pvi=7145755648; BAIDUID=28DEC113C666529BA3CDA3D7B9BB371F:FG=1; BIDUPSID=28DEC113C666529BA3CDA3D7B9BB371F; PSTM=1531802555; BD_UPN=12314353; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598
 
 
 
 
HTTP響應格式
 
 
HTTP響應格式

HTTP/1.1 200 OK
Bdpagetype: 1
Bdqid: 0xe23fd0420000b189
Cache-Control: private
Connection: Keep-Alive
Content-Encoding: gzip
Content-Type: text/html
Cxy_all: baidu+1302051616dc8b2d14e6f36b4bbd9140
Date: Wed, 25 Jul 2018 05:08:29 GMT
Expires: Wed, 25 Jul 2018 05:07:40 GMT
Server: BWS/1.1
Set-Cookie: BDSVRTM=0; path=/
Set-Cookie: BD_HOME=0; path=/
Set-Cookie: H_PS_PSSID=1423_21116_18559_26350_22159; path=/; domain=.baidu.com
Strict-Transport-Security: max-age=172800
Vary: Accept-Encoding
X-Ua-Compatible: IE=Edge,chrome=1
Transfer-Encoding: chunked

 
 

相關文章