HTTP message query

HTTP message

Query http message process:
for example: www.baidu.com
open Google browser-> shortcut key F12-> Network-> Doc
as shown in the figure:
Insert picture description here
if www.baidu.com is not displayed, refresh in the upper left corner of the browser
Then click www.baidu.com to inquire.
There are request header and response header information

Request

Click the inverted triangle on the left side of the Request Headers and then click the view source on the right

GET / HTTP/1.1  #请求行
Host: www.baidu.com   #主机地址
Connection: keep-alive   #表示TCP未断开
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64;x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36   #产生请求的浏览器类型
Sec-Fetch-Dest: document
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: ......    #用户安全凭证

HTTP / 1.1: Protocol and version
command requests also include: GET, POST, HEAD (the server only returns http header messages, not page content), PUT (upload url specified description), DELETE (delete specified resources), OPTIONS (return HTTP methods supported by the server), TRACE, CONNECT

Request:
request line (header) + data body (body)
data body in the Get request does not have
content in Post = ... #data body content
Note:
Once the hacker gets your cookie, you can Post with your user credentials and view personal information, etc.

Response

HTTP/1.1 200 OK   #状态行  协议及状态码
Bdpagetype: 1
Bdqid: 0xaa461872000184f8
Cache-Control: private
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html;charset=utf-8
Date: Sat, 21 Mar 2020 03:24:28 GMT
Expires: Sat, 21 Mar 2020 03:23:34 GMT
Server: BWS/1.1
Set-Cookie: BDSVRTM=0; path=/  #web服务器向浏览器颁发凭证
Set-Cookie: BD_HOME=1; path=/
Set-Cookie: H_PS_PSSID=30970_1465_31125_21091_30824_30717; path=/; domain=.baidu.com
Strict-Transport-Security: max-age=172800
Traceid: 1584761068042079386612269521112722932984
X-Ua-Compatible: IE=Edge,chrome=1
Transfer-Encoding: chunked

Response:
status line (status line) + message header + response text
Response text = right click on the webpage "view source"

Supplement: About the status code and its response
1xx: Indicating information—Indicating that the request has been received and processing continues.
2xx: Success—Indicates that the request has been successfully received, understood, and accepted.
3xx: Redirect—Further actions are required to complete the request.
4xx: Client error—The request has a syntax error or the request cannot be fulfilled.
5xx: Server-side error—The server failed to fulfill a legitimate request.

Published 19 original articles · Like1 · Visits 383

Guess you like

Origin blog.csdn.net/weixin_45798017/article/details/105001795