Universal header field (i.e., universal header)The generic header domain contains header domains that both request and response messages support, and the generic header domain contains Cache-control, Connection, Date, Pragma, transfer-encoding, Upgrade, Via. The expansion of the universal header domain requires both parties to support this extension, and if there is an unsupported universal header domain, it will generally be handled as the entity header domain.
Cache-control Header FieldCache-control Specifies the caching mechanism that requests and responses follow. Setting Cache-control in a request message or response message does not modify the caching process in another message processing process. cache directives on request include No-cache, No-store, Max-age, Max-stale, Min-fresh, only-if-cached,the directives in the response message include public, private, No-cache, No-store, No-transform, Must-revalidate, Proxy-revalidate, and Max-age. the instructions in each message have the following meanings:Public indicates that the response can be cached by any buffer;private indicates that the entire or partial response message for a single user cannot be shared with the cache. This allows the server to simply describe a partial response message for the user, and this response message is not valid for another user's request;No-cache indicates that the request or response message cannot be cached;No-store is used to prevent the inadvertent release of important information. Sending in the request message will make the request and response messages do not use the cache;Max-age indicates that the client can receive a response that is not longer than the specified time (in seconds);Min-fresh indicates that the client can receive a response time that is less than the current time plus a specified time;Max-stale indicates that the client can receive a response message that exceeds the timeout period. If you specify a value for the Max-stale message, the client can receive a response message that exceeds the specified value for the timeout period.
Connection Request: Close (Tell the Web server or proxy server, after completing the response to this request, disconnect, do not wait for subsequent requests for this connection). keepalive (tells the Web server or proxy server, after completing the response of this request, remains connected, waiting for subsequent requests for this connection). response: Close (the connection is closed). KeepAlive (connection is maintained, waiting for subsequent requests for this connection). keep-alive: If the browser requests to remain connected, the header indicates how long (in seconds) you want the WEB server to remain connected. Example: keep-alive:300
Method Request-uri http-versionmethod indicates that the field is case-sensitive for Request-uri completion, including options,, POST, PUT, DELETE, TRACE. Method get and head should be supported by all common Web servers, the implementation of all other methods is optional, the GET method retrieves the information identified by the Request-uri, and the head method also retrieves the information identified by the Request-uri, except that the message body can be returned in response The Post method can request that the server receive entity information contained in the request and can be used to submit the form and send messages to newsgroups, BBS, mail groups, and databases. Request-uri represents the requested URL. Request-uri follows the URI format, where the word Cheweishing (*) indicates that the request is not used for a particular resource address, but rather for the server itself. Http-version represents the supported HTTP version, for example, http/1.1. the request header domain allows the client to pass additional information about the request or about the client to the server. The request header field may contain the following word
segments Accept, Accept-charset, accept-encoding, Accept-language, Authorization, from, Host, If-modified-since, If-match, If-none-match, If-range, If-range, If-unmodified-since, Max-forwards, Proxy-authorization, Range, Referer, User-agent. extensions to the request header domain are supported by both parties, and if an unsupported request header domain exists, it will generally be handled as the entity header domain. The host header domain Specifies the intenet host and port number of the requesting resource, and must represent the location of the originating server or gateway that requested the URL. The http/1.1 request must contain the host header domain or the system will return with a 400 status code;Accept : Tell the Web server what type of media it accepts, */* represents any type, type/* represents all sub-types under that type, Type/sub-type. Accept-charset: The browser affirms the character set it receives. Authorization: When the client receives a www-authenticate response from the Web server, it uses that header to respond to its own authentication information to the Web server. the contents of the User-agent header domain contain the user information that made the request
.
The Referer header domain allows the client to specify the source resource address of the request URI, which allows the server to generate a fallback list that can be used to log in, optimize the cache, and so on. He also allows the abolition or wrong connection to be traced for maintenance purposes. If the requested URI does not have its own URI address, Referer cannot be sent. If a partial URI address is specified, the address should be a relative address;
the Range header field can request one or more child ranges of an entity. (??? )Response Message (response header)The first behavior of the response message is in the following format:http-version Status-code reason-phraseHttp-version represents the supported HTTP version, for example, http/1.1. Status-code is a result code of three numbers. Reason-phrase provides a simple text description for Status-code. Status-code is mainly used for machine automatic identification, reason-phrase is mainly used to help users understand. The first number of Status-code defines the category of the response, and the latter two numbers do not have a role to classify. The first number can take 5 different values:1XX: Information response class, which indicates receipt of request and continues processing2XX: Handle the successful response class, indicating that the action was successfully received, understood, and accepted3xx: Redirect Response class, must accept further processing in order to complete the specified action4xx: Client error, client request contains syntax error or is not executed correctly5xx: Server error, servers do not correctly execute a correct requestThe response header field allows the server to pass additional information that cannot be placed on the status line, which primarily describes the server's information and Request-uri further information. The Response header field contains age, location, proxy-authenticate, public, Retry-after, Server, Vary, Warning, and Www-authenticate. The expansion of the response header field is required for both sides of the communication, and if there is an unsupported response header field, it will generally be handled as the Entity header field. A typical response message:http/1.0 OKDate:mon,31dec200104:25:57gmtserver:apache/1.3.14 (Unix)content-type:text/htmlLast-modified:tue,17apr200106:46:28gmtEtag: "a030f020ac7c01:1e9f"content-length:39725426content-range:bytes554554-40279979/40279980the first line in the previous example represents an HTTP service-side response to a GET method. The brown part represents the Response header field information, the green part represents the General header section, and the red part represents the Entity header field information. the location response header is used to redirect the recipient to a new URI address. The server response header contains software information for the originating server that processed the request. This field can contain multiple product identifiers and annotations, and product identities are generally sorted by importanceentity messages (Entity headers and entities)both the request message and the response message can contain entity information, which generally consists of entity header fields and entities. The Entity header field contains the original information about the entity, including allow, Content-base, content-encoding, Content-language, Content-length, Content-location, CONTENT-MD5, Content-range, Content-type, Etag, Expires, Last-modified, Extension-header. Extension-header allows clients to define new entity headers, but these domains may not be recognized by the recipient. The content-type entity header is used to indicate the media type of the entity to the receiver, specify the entity media type that the head method sends to the receiver, or the request media type sent by the Get method, indicating what MIME type the subsequent document belongs to. The content-length represents the number of bytes actually transferred. Allow entity headers to which request methods (such as Get, post, and so on) are supported by the server. Content-range represents the range of the transfer, which specifies the insertion position of a part of the entire entity, and he also indicates the length of the entire entity. When the server returns a partial response to the customer, it must describe the extent of the response coverage and the entire length of the entity. General format:Content-range:bytes-unitspfirst-byte-pos-last-byte-pos/entity-legthFor example, transfer the header 500 bytes in the form of a secondary field: content-range:bytes0-499/1234 If an HTTP message contains this section (for example, a response to a range request or an overlapping request to a range of scopes). Content-encoding refers to the encoding (Encode) method of the document. an entity can be a coded stream of bytes encoded by content-encoding or Content-type, whose length is defined by content-length or Content-range. Appendix:
HTTP Header Explanation1, Accept: Tell the Web server to accept what the media type, */* represents any type, type/* represents all sub-types under the type, Type/sub-type. 2. Accept-charset: The character set that the browser affirms itself to receiveaccept-encoding: The browser declares itself to receive the encoding method, usually specifies the compression method, whether compression is supported, what compression method is supported (Gzip,deflate)Accept-language:: Browser affirms the language you receivethe difference between language and character set: Chinese is language, Chinese has many character sets, such as BIG5,GB2312,GBK and so on. 3. The Accept-ranges:web server indicates whether it accepts requests to obtain part of an entity (such as a part of a file). Bytes: Accept, none: Indicates not accepted. 4. Age: When the proxy server responds to a request with its own cached entity, it is used to indicate how long the entity has been from the time it was produced to the present. 5. Authorization: When the client receives the Www-authenticate response from the Web server, it uses the header to respond to its own authentication information to the Web server. 6, Cache-control: Request: No-cache (do not cache the entity, request now from the Web server to fetch)Max-age: (Accept only the age value is less than the Max-age value, and there are no expired objects)Max-stale: (Can accept past objects, but the expiration time must be less than Max-stale value)Min-fresh: (accepts cached objects whose freshness life is greater than the sum of its current age and Min-fresh values)Response: Public (can respond to any user with Cached content)private (only cached content can be used to respond to the user who previously requested the content)No-cache (can be cached, but only after the Web server has verified that it is valid to be returned to the client)max-age: (The expiration time of the object contained in this response)All:no-store (cache not allowed)7, Connection: Request: Close (Tell the Web server or proxy server, after completing the response of this request, disconnect, do not wait for subsequent requests for this connection). keepalive (tells the Web server or proxy server, after completing the response of this request, remains connected, waiting for subsequent requests for this connection). response: Close (the connection is closed). KeepAlive (connection is maintained, waiting for subsequent requests for this connection). keep-alive: If the browser requests to remain connected, the header indicates how long (in seconds) you want the WEB server to remain connected. Example: keep-alive:3008. The Content-encoding:web server indicates what compression method (Gzip,deflate) is used to compress the object in the response. Example: Content-encoding:gzip9. The Content-language:web server tells the browser the language of the object it responds to. 10. The Content-length:web server tells the browser the length of the object it responds to. Example: content-length:2601211. The Content-range:web server indicates which part of the entire object the response contains. Example: Content-range:bytes 21010-47021/4702212. The Content-type:web server tells the browser what type of object it responds to. Example: Content-type:application/xml13, ETag: is an object (such as the URL) of the flag value, in terms of an object, such as an HTML file, if modified, its etag will not be modified, so the role of the etag is similar to the role of last-modified, mainly for the WEB The server determines whether an object has changed. For example, when a previous request for an HTML file, the ETag was obtained, and when the file is requested, the browser will send the previously obtained ETag value to the Web server, and then the Web server will compare the ETag with the file's current etag, and then know that the file has not changed The 14. The Expired:web server indicates when the entity will expire and, for expired objects, can be used to respond to customer requests only after it has verified its validity with the Web server. It's http/1.0 's head. Example: Expires:sat, 10:02:12 GMT15. Host: The client specifies the domain/IP address and port number of the Web server that you want to access. Example: Host:rss.sina.com.cn16, If-match: If the object's ETag does not change, it means that the object does not change, only to perform the requested action. 17. If-none-match: If the ETag of an object changes, it also means that the object has changed to perform the requested action. 18. If-modified-since: If the requested object is modified after the time specified by the header, the requested action (such as the return object) is executed, otherwise the code 304 is returned, telling the browser that the object has not been modified. Example: If-modified-since:thu, APR 09:14:42 GMT19. If-unmodified-since: If the requested object is not modified after the time specified in the header, the requested action (such as returning an object) is performed. 20. If-range: The browser tells the WEB server that if the object I requested does not change, give me the missing part, and if the object changes, give me the whole object. The browser can tell the WEB server whether the object has changed by sending the ETag of the requested object or the last modification time it knows. Always used with the Range header. 21, the Last-modified:web server considers the last modification time of the object, such as the last modification time of the file, the last generation time of the dynamic page, etc. For example: Last-modified:tue, may 02:42:43 GMT22. The Location:web server tells the browser that the object you are trying to access has been moved to a different location to fetch it at the location specified by the header. Example: Location:http://i0.sinaimg.cn/dy/deco/2008/0528/sinahome_0803_ws_005_text_0.gif23, Pramga: The main use of pramga:no-cache, equivalent to Cache-control:no-cache. Example: Pragma:no-cache24. Proxy-authenticate: The proxy server responds to the browser and requires it to provide proxy authentication information. Proxy-authorization: The browser responds to the proxy server's authentication request and provides its own identity information. 25. Range: The browser (such as Flashget multi-threaded download) tells the WEB server what part of the object you want to take. Example: range:bytes=1173546-26. Referer: The browser indicates to the Web server which page/url obtained/clicked on the URL/url in the current request. Example: referer:http://www.sina.com/27, Server:web server indicates what software and version of the information. Example: server:apache/2.0.61 (Unix)28. User-agent: The browser indicates its identity (which browser). For example: user-agent:mozilla/5.0 (Windows; U Windows NT 5.1; ZH-CN; rv:1.8.1.14) gecko/20080404 firefox/2, 0, 0,29. Transfer-encoding:web server indicates how to encode the response message body (not the object inside the message body), such as whether it is chunked (chunked). Example: transfer-encoding:chunked30. The Vary:web server uses the contents of the header to tell the Cache server under what conditions the object returned by this response responds to subsequent requests. If the source Web server receives the first request message, the header of its response message is: Content-encoding:gzip; Vary:content-encoding then the cache server parses the header of the subsequent request message and checks if its accept-encoding is consistent with the Vary header value of the previous response, that is, whether the same content encoding method is used, which prevents the cache The server responds to the compressed entity in its own Cache to a browser that does not have the ability to decompress. Example: Vary:accept-encoding31. Via: Lists the proxies from the client to the OCS or in the opposite direction, and what protocol (and version) they are using to send the request. When the client request arrives at the first proxy server, the server adds via header in its own request and fills in its own information, and when the next proxy receives a request from the first proxy server, it copies the Via header of the request from the previous proxy server in its own request. and add their own information to the back, and so on, when OCS receives the last Proxy server request, check Via header, know the route that the request passes. Example: via:1.0 236.d0707195.sina.com.cn:80 (SQUID/2.6.STABLE13)
HTTP Header Explanation