HTTP请求格式和HTTP响应格式
Posted time-fly
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTTP请求格式和HTTP响应格式相关的知识,希望对你有一定的参考价值。
HTTP请求格式
"GET {} HTTP/1.1
host: {}
Connection
".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
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
以上是关于HTTP请求格式和HTTP响应格式的主要内容,如果未能解决你的问题,请参考以下文章