The meaning of each field in the http header

1. Accept: Tell the WEB server what media type it accepts

*/* represents any type, type/* represents all subtypes under the type, and type/sub-type represents the specified type.

2. Accept-Charset: The character encoding set that the browser can accept

3. Accept-Encoding: The browser declares the encoding method it receives, usually specifying the compression method, whether it supports compression, and what compression methods it supports (gzip, deflate)

4. Accept-Language: The browser declares the difference between the language it receives and the character set: Chinese is a language, and Chinese has multiple character sets, such as big5, gb2312, gbk, etc.

5. Accept-Ranges: The WEB server indicates whether it accepts a request to obtain a part of one of its entities (such as a part of a file). bytes: indicates acceptance, none: indicates not acceptance.

6. Authorization: When the client receives the WWW-Authenticate response from the WEB server, this header responds with its own authentication information to the WEB server.

7. Cache-Control: Request: no-cache (the entity is not cached and is required to be retrieved from the WEB server now)

8. Connection: Indicates whether a persistent connection is required. (HTTP 1.1 makes persistent connections by default)

Request: close (tell the WEB server or proxy server to complete the response to this request

After that, disconnect and do not wait for subsequent requests for this connection).

keepalive (tell the WEB server or proxy server to keep the connection after completing the response to this request and wait for subsequent requests for this connection).

Response: close (the connection has been closed).

keepalive (the connection is maintained, waiting for subsequent requests for this connection).

Keep-Alive: If the browser requests to keep the connection, this header indicates how long (in seconds) it wants the WEB server to keep the connection.

For example: Keep-Alive: 300

 9. Cookie: When an HTTP request is sent, all cookie values ​​stored in the requested domain name will be sent to the web server.

tips:

A cookie is a small text file that is stored on a user's computer when the user visits a website. (Text files exist under system32) They have the following functions:

  1. Session Management: The most common use is to track session information when a user visits a website. By using cookies, the website can maintain the user's login status when the user visits different pages or revisits, so that the user does not need to log in again every time.

  2. User personalization: Cookies can store the user's personalized settings and preferences, such as language selection, theme preferences, or product information in the shopping cart. In this way, users do not need to set it up again the next time they visit the website.

  3. Tracking and analysis: Through cookies, websites can track and analyze user behavior, such as recording the pages clicked by users, length of visit, and browsing habits. This data can help the website optimize user experience and improve website performance.

  4. Advertising targeting: Cookies can also be used for advertising targeting, which is to provide relevant advertising to users based on their interests and behavior. By analyzing users' cookie data, advertising companies can deliver ads more accurately and improve advertising effectiveness.

There is also the fact that cookies are sent to the user's computer by the website and therefore can potentially reveal the user's personal information. For privacy and security reasons, browsers often allow users to choose whether to accept cookies and to control which websites can access them.

10. Host: The client specifies the domain name/IP address and port number of the WEB server it wants to access.

For example: Host:127.0.0.1:8080

11. Referer: The browser indicates to the WEB server which web page/URL it obtained/clicked on the URL/URL in the current request.

For example: Referer: www.baidu.com

12. Location: Used to redirect the recipient to the location of the non-requested URL to complete the request or identify a new resource.

Location: http://www.zcmhi.com/archives/94.html

13. Content-Type: The WEB server tells the browser the type of object it responds to.

For example: Content-Type: application/xml

14. Content-Length: The WEB server tells the browser the length of the object it responds to.

For example: Content-Length: 26012

15. Content-Range: The WEB server indicates which part of the entire object the partial object contained in the response is.

For example: Content-Range: bytes 21010-47021/47022

16. Content-Encoding: The WEB server indicates what compression method (gzip, deflate) it uses to compress the objects in the response.

For example: Content-Encoding: gzip

17. Content-Language: The WEB server tells the browser the language of the object it responds to.

18. Proxy-Authenticate: The proxy server responds to the browser, asking it to provide proxy authentication information.

Proxy-Authorization: The browser responds to the proxy server's authentication request and provides its own identity information.

19. Server: The WEB server indicates what software it is and its version.

For example: Server:Apache/2.0.61 (Unix)

20. User-Agent: The browser indicates its identity (which browser it is, specific version).

For example:

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:79.0)

Gecko/20100101 Firefox/79.0

Response codes and their meanings

100 continue

101 Packet Switching Protocol

200 success

201 was created

202 adopted

203 Unauthorized information

204 No content

205 Reset content

Part 206

300+ options

301 Sent permanently

302 found

303 See other

304 unchanged

305 Use proxy

307 Temporary Redirect

400 Bad Request

401 Unauthorized

402 Payment required

403 Forbidden

404 Not Found

405 Method not allowed

406 not accepted

407 Agent authorization required

408 Request timeout

409 conflict

410 expired

411 Required length

412 The premise is not established

413 Request instance too large

414 Request URI too large

415 Unsupported media type

416 Unsatisfiable request range

417 Failed Expectations

500 Internal Server Error

501 not used

502 Gateway error

503 Unavailable service

504 Gateway timeout

505 HTTP version not supported

Guess you like

Origin blog.csdn.net/qq_56698744/article/details/133176473