请求request的组成
(1)请求头(请求方式(post get) path http1.1)PS:http1.0和http1.1的区别:1.0对于每个资源都需要发送一次请求,1.1是一次请求可以获取多个资源。
(2)请求行
(3)请求体 只有post请求才会有请求体
例如输入https://www.baidu.com/ 请求request如下所示
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
Cache-Control: max-age=0
Connection: keep-alive
Cookie: BAIDUID=81634667296C9AA00B2BDFD7A446251F:FG=1; BIDUPSID=81634667296C9AA00B2BDFD7A446251F; PSTM=1486793561; MCITY=-131%3A; BDUSS=53RnlPZFQ5aEJ3YXN1QnlabEd5dXpjMmVuczB3SzdvblNZRHdhYzNjQ1ltT2haSVFBQUFBJCQAAAAAAAAAAAEAAABamHRPc21pbGXH2cfZc21pbGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJgLwVmYC8FZdW; BD_UPN=12314353; delPer=0; BD_CK_SAM=1; PSINO=2; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; BDRCVFR[mkUqnUt8juD]=mk3SLVN4HKm; H_PS_645EC=87ca6JkdlEAaHg50l6P63jfDS%2BW2A6rVQP3r0It%2B9fmlqs%2F7eaMaPUlAdUSUvUbAo90XxA; BDORZ=FFFB88E999055A3F8A630C64834BD6D0; BD_HOME=1; H_PS_PSSID=1422_21089_18560_27400_26350
Host: www.baidu.com
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3423.2 Safari/537.36
响应的组成
(1)响应头(http1.1 响应码 原因叙述)
(2)响应行
(3)响应体 html文本
Bdpagetype: 2
Bdqid: 0x91d35b1600043826
Cache-Control: private
Connection: Keep-Alive
Content-Encoding: gzip
Content-Type: text/html;charset=utf-8
Date: Sun, 18 Nov 2018 06:15:39 GMT
Expires: Sun, 18 Nov 2018 06:15:38 GMT
Server: BWS/1.1
Set-Cookie: BDSVRTM=310; path=/
Set-Cookie: BD_HOME=1; path=/
Set-Cookie: H_PS_PSSID=1422_21089_18560_27400_26350; path=/; domain=.baidu.com
Strict-Transport-Security: max-age=172800
Transfer-Encoding: chunked
X-Ua-Compatible: IE=Edge,chrome=1
一般参数为
Request URL: https://www.baidu.com/
Request Method: GET
Status Code: 200 OK
Remote Address: 61.135.169.121:443
Referrer Policy: no-referrer-when-downgrade