Get https://www.baidu.com/ HTTP/1.1 ------------------------------------------------------------------------------- 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,en;q=0.8,zh-TW;q=0.7,ja;q=0.6 Cache-Control: no-cache Connection: keep-alive Cookie: ... Host: www.baidu.com Pragma: no-cache Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
HTTP/1.1 200 OK ------------------------------------------------------------------------------- Bdpagetype: 2 Bdqid: 0xd511e4460001e2c0 Cache-Control: private Connection: Keep-Alive Content-Encoding: gzip Content-Type: text/html;charset=utf-8 Date: Mon, 15 Oct 2018 15:34:34 GMT Expires: Mon, 15 Oct 2018 15:34:34 GMT Server: BWS/1.1 Set-Cookie: BDSVRTM=223; path=/ Set-Cookie: BD_HOME=1; path=/ Set-Cookie: H_PS_PSSID=1434_21124_26350_20928; path=/; domain=.baidu.com Strict-Transport-Security: max-age=172800 Transfer-Encoding: chunked X-Ua-Compatible: IE=Edge,chrome=1 ------------------------------------------------------------------------------- Body...
與HTTP1.x使用起始行來指定URI,請求方法,狀態碼等不一樣, HTTP2使用專門的僞頭部來實現此目的(以':'做爲開頭).
全部的僞頭部必須在經常使用首部以前出現.html
:authority: developer.mozilla.org :method: GET :path: /en-US/docs/Web/HTTP/Basics_of_HTTP :scheme: https Referrer Policy: no-referrer-when-downgrade 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,en;q=0.8,zh-TW;q=0.7,ja;q=0.6 cache-control: max-age=0 cookie: ... referer: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
在HTTP2中除了TE頭部之外再也不有鏈接相關的頭部,包括:Keep-Alive, Proxy-Connection,Transfer-Encoding,和Upgrade等web
詳情查看[Web高級_Http方法詳解]chrome
詳情查看[Web高級_Http頭部詳解]服務器
詳情查看[Web高級_Http狀態碼詳解]cookie
refs:
https://tools.ietf.org/html/rfc2616
https://tools.ietf.org/html/rfc7540
https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Statusapp