Request header (request) and response header (response)

Request header (request) and response header (response)

The front-end (client) sends a request to the back-end (server), the back-end responds to the request, and feeds back corresponding resources to the front-end.
1. Request header:
consists of four parts: the first line, header, blank line, body (store url parameters).
First line: parameter transfer method (GET or POST) + url + version number (such as Http1.1).
header: Consists of multiple sets of parameters (key-value).
Blank line: marks the end of the header.
Body: If the parameter transfer method is GET, then the body is empty. If it is POST, the parameters sent are all in the body.
2. Response header:
consists of four parts: the first line, header, blank line, body (store url parameters).
First line: version number + status code + status code information description
header: consists of multiple sets of parameters (key-value).
Blank line: marks the end of the header.
Body: If the parameter transfer method is GET, then the body is empty. If it is POST, the parameters sent are all in the body.
There are five categories of status codes:

1xx Informational status code
2xx Success status code
3xx Redirection status code
4xx Client error status code
5xx Server error status code

Commonly used status codes:
200 (indicating that the request is processed successfully)
301 (indicating permanent redirection: for example, my current page is always bound to the current content and will not be tampered with).
302 (indicating temporary steering: unsafe, there may be a risk of tampering at any time).
403 (indicating that the client's current access permissions are insufficient).
404 (indicating that the requested resource sent by the client was not found).
500 (indicating an abnormality or BUG in the back-end program).
502 (The server received an invalid response from the upstream server).
504 (Gateway timeout).
505 (The server does not support the current Htttp protocol version).

Guess you like

Origin blog.csdn.net/qq_45841205/article/details/115288417