HTTP header details
HTTP (hypertexttransferprotocol) is the hypertext transfer protocol, which is currently a common protocol for webpage transmission. The HTTP protocol uses the request/response model. The browser or other clients send requests and the server responds to the requests. The entire network resource transmission involves message-header and message-body. First pass the message-header, that is, the HTTP header message. HTTP header messages are generally divided into four parts: General header, request header, response header, and entity header. However, in terms of understanding this method, I feel that the boundary is not clear. According to the content organization of HTTP headers in Wikipedia, the content is divided into two parts: request and response.
Requests
Header interpretation example
Accept specifies the content type that the client can receive. Accept: text/plain, text/html
Accept-charset the character sequence set acceptable to the browser. Accept-charset: iso-8859-5
Accept-encoding specifies the type of content compression encoding returned by the Web server supported by the browser. Accept-encoding: compress, Gzip
The language accept-language: En, ZH
Accept-ranges can request one or more sub-range fields of the webpage object accept-ranges: bytes
Authorization HTTP Authorization authorization certificate authorization: Basic qwxhzgrpbjpvcgvuihnlc2ftzq = www.2cto.com
Cache-control specifies the cache mechanism for requests and responses. cache-control: No-Cache
Connection indicates whether a persistent connection is required. (HTTP 1.1 performs a persistent connection by default) connection: Close
When a cookie HTTP request is sent, all the cookie values saved under the request domain name are sent to the web server. COOKIE: $ version = 1; Skin = new;
Content-Length Content Length: 348
Content-Type: Application/X-WWW-form-urlencoded
Date request sent date: Tue, 15 Nov 2010 08:12:31 GMT
Specific server behavior of the response ct request: 100-continue
From: [email protected]
Host specifies the domain name and port number of the requested Server Host:
If-match is valid only when the request content matches the object. If-Match: "737060cd8c284d8af7ad3082f209582d"
If-modified-since: if the requested part is modified after the specified time, the request is successful. If-modified-since: sat, 29 Oct 304 19:43:31 GMT is returned if-modified-since: sat, 29 Oct 2010
If-None-Match: if the content is not changed, code 304 is returned. The parameter is the etag previously sent by the server. Compare it with the etag responded by the server to determine whether to change if-None-match: "737060cd8c284d8af7ad3082f209"
If-range: if the object is not changed, the server sends the part lost by the client; otherwise, the whole object is sent. The parameter is also etag if-range: "737060cd8c284d8af7ad3082f209582d"
If-unmodified-since is requested to succeed only when the object is not modified after the specified time. If-unmodified-since: sat, 29 Oct 2010 19:43:31 GMT www.2cto.com
Max-forwards: 10
Pragma is used to contain specific instructions Pragma: No-Cache
Proxy-authorization: Basic qwxhzgrpbjpvcgvuihnlc2ftzq =
Range is only part of the request object. The specified range is range: bytes = 500-999.
The address of the previous Referer webpage, followed by the current requested webpage, that is, the origin Referer: http: // archives/71.html
The transmission code that the Te client is willing to accept and notifies the server to accept the tail header information. Te: trailers, deflate; q = 0.5
Upgrade specifies a certain transmission protocol to the server for server conversion (if supported) Upgrade: HTTP/2.0, shttp/1.3, IRC/6.9, RTA/X11
The content of User-Agent contains the user information of the request. User-Agent: Mozilla/5.0 (Linux; X11)
Via notifies the intermediate gateway or proxy server address, communication protocol via: 1.0 Fred, 1.1 nowhere.com (Apache/1.1)
Warning warning information about message entities warn: 199 miscellaneous warning
Responses section www.2cto.com
Header interpretation example
Accept-ranges indicates whether the server supports the specified range request and the type of segment request accept-ranges: bytes
Estimated age from the original server to the proxy cache (in seconds, non-negative) Age: 12
Allow is a valid request action for a network resource. If the request is not allowed, 405 allow: Get, head is returned.
Cache-control indicates whether all cache mechanisms can be cached and what type of cache-control: No-Cache
The encoding type of the returned content supported by the content-encoding web server. Content-encoding: Gzip
Content-language: En, ZH
Content-Length response body length Content-Length: 348
Another alternative content-location:/index.htm address of the content-location request Resource
Content-MD5 returned resource MD5 checksum Content-MD5: q2hly2sgsw50zwdyaxr5iq =
Content-range: bytes 21010-47021/47022
Content-Type: the MIME type of the returned content. Content-Type: text/html; charset = UTF-8
Date: Tue, 15 Nov 2010 08:12:31 GMT
Etag: "737060cd8c284d8af7ad3082f209582d"
Expires response expiration date and time expires: Thu, 01 Dec 2010 16:00:00 GMT
Last-modified last modification time of the requested resource last-modified: Tue, 15 Nov 2010 12:45:26 GMT
Location is used to redirect the recipient to a location other than the requested URL to complete the request or identify the new resource location: http: // archives/94.html
Pragma includes the implementation of specific commands, which can be applied to any receiver of the response chain Pragma: No-Cache
Proxy-authenticate indicates the authentication scheme and the parameter proxy-Authenticate: Basic that can be applied to the URL of the proxy
Refresh is applied to redirection or a new resource is created. It will be redirected 5 seconds later (proposed by Netscape and supported by most browsers) www.2cto.com
Refresh: 5; url =
Http: // archives/94.html
Retry-after: if the object is temporarily unavailable, notify the client to try retry-after: 120 again after the specified time
Server web server software name server: Apache/1.3.27 (UNIX) (red-hat/Linux)
Set-Cookie set HTTP Cookie set-COOKIE: userid = johndoe; max-age = 3600; version = 1
Trailer indicates that the header domain has a trailer: Max-Forwards at the end of the multipart transfer encoding.
Transfer-encoding File Transfer Encoding Transfer-encoding: chunked
Vary tells the downstream proxy whether to use cache response or request vary from the original server :*
Via tells the proxy client where the response is sent via: 1.0 Fred, 1.1 nowhere.com (Apache/1.1)
Warning warning possible entity problems warning: 199 miscellaneous warning
WWW-authenticate indicates the authorization scheme www-Authenticate: Basic that the client request entity should use
This article from the "Linux O & M" blog, please be sure to keep this source http://utrace.blog.51cto.com/2213120/1546426
HTTP header details