Article Directory
There are four data format of the request message. In the Network Browser Developer Tools page, you can view the information. The following four kinds of data format of the request message is introduced, describes 请求行
and 请求头
.
(1) Request line
GET/login.html HTTP/1.1
Cong left to right, respectively 请求方式
请求url
请求协议/版本
.
Request mode : http protocol has seven kinds of request methods commonly used are get and post in two ways:
①GET:
- Request parameters in the request line. (It may also be understood as the url)
- url requests limited length.
- Insecurity.
②POST:
- Request parameters in the request body.
- url length of the request is not limited.
- Safety.
(2) the request header
Request header is a key-value pairs: 请求头名称:请求头值
.
Request heads are 客户端告诉服务器一些信息
.
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 12
Connection: keep-alive
Referer: http://localhost:8080/Servlet&http&request/login.html
Upgrade-Insecure-Requests: 1
Request header | Request header value |
---|---|
Host | Requesting host |
User-Agent |
The browser used to access the server 浏览器版本信息 (the server after the acquisition, to resolve browser compatibility issues) |
Accept | Supported file formats |
Accept-Language | Supported languages |
Accept-Encoding | Supported compression formats |
Referer |
告诉服务器,请求从哪里来。作用:1.防盗链2.统计工作 |
Connection |
Shows a state of connection (alive can be multiplexed) |
Upgrade-Insecure-Requests | Information about upgrading |
(3) Request blank lines
Request header for dividing the POST request, and the request body.
(4) the request body (body)
Package POST Request message parameter.