Original address: http://www.cnblogs.com/devinzhang/archive/2012/02/06/2340186.html
HTTP messages consist of client-to-server requests and server-to-client responses. Both the request message and the response message are from the start line (for the request message, the start line is the request line; For the response message, the start line is the status line), the message header (optional), the empty line (only the CRLF line), and the message body (optional).
The HTTP message header includes the normal header, the request header, the response header, and the entity header. Each header field consists of a name + ":" + a Space + value, and the name of the message header field is case-insensitive.
1. Request Header
The request header allows the client to pass additional information about the request to the server side, as well as the client itself.
Common Request Headers
The Accept Request header field is used to specify which types of information the client accepts.
The Accept-charset request header field is used to specify the character set accepted by the client.
The Accept-encoding request header field is similar to accept, but it is used to specify acceptable content encoding.
The Accept-language request header field is similar to accept, but it is used to specify a natural language.
The authorization request header domain is primarily used to prove that a client has permission to view a resource.
The host request header domain is primarily used to specify the Internet host and port number of the requested resource, which is typically extracted from the HTTP URL. The User-agent request header domain allows the client to tell the server about its operating system, browser, and other properties.
2. Response header
The response header allows the server to pass additional response information that cannot be placed in the status line, as well as information about the server and the next access to the resources identified by Request-uri.
Common response Headers
The Location response header field is used to redirect the recipient to a new position. Location response header fields are commonly used when changing domain names.
The server Response header field contains the software information that the server uses to process the request
3. Entity Header
Both request and response messages can send an entity.
Common entity Headers
Content-encoding indicates the encoding of additional content that has been applied to the entity body.
The Content-language Entity header field describes the natural language used by the resource.
The Content-length Entity header field is used to indicate the length of the entity body, expressed as a decimal number stored in bytes.
The Content-type Entity header field term indicates the media type that is sent to the recipient's entity body.
The Last-modified Entity header field is used to indicate the last modification date and time of the resource.
The Expires Entity header field gives the date and time when the response expires.
HTTP protocol Detailed message header