HTTP header fields include 4 categories: general-header; Request-header; Response-header; Entity-header. ******************************************************************************* General Header Fields ============================= General header is available for request, response, but not for entity. --Cache-control --Connection --Date --Pragma --Trailer --transfer-encoding -- Upgrade --Via --Warning *********** request Header Fields ================= ===== request-header fields allows clients to deliver additional information about the request and client to the server, - Accept --accept-charset -- Accept-encoding --accept-language -- Authorization --Expect --from --Host --If-match --If-modified-since --If-none-match --If-range --If-unmodified-since --Max-forwards --Proxy-authorization --range --Referer --TE --user-agent ****************************************************** Response Header Fields =============================== Response-header fields allows the server to pass additional information about response that cannot be put to status-line. These headers give information about the service side. --accept-ranges --age --ETag --location -- Proxy-authenticate --retry-after --Server --vary --www-authenticate ******************** entity Header Fields ======================== entity-header fields defines metainformation (header field data) about Entity-body, if there is no body at the moment, the definition isResource information determined by the request. some metainformation are optional; Some of them are necessary. --Allow --content-encoding & nbsp; --Content-language --content-length --Content-location --Content-md5 --Content-range --Content-type --Expires --last-modified -Extension-header First, basic HTTP (HYPERTEXTTRANSFERPROTOCOL) is the abbreviation of Hypertext Transfer Protocol, it is used to transmit the data of WWW method, For more information on HTTP protocol, please refer to RFC2616. The HTTP protocol uses a request/response model. The client sends a request to the server that contains the requested method, URI, protocol version, and a mime-like message structure that contains the request modifiers, customer information, and content. The server responds with a status line, which includes the version of the message protocol, the success or error code plus the containing server information, entity meta information, and possible entity content. Typically, HTTP messages include the client's request message to the server and the server's response message to the client. The two types of messages consist of a starting row, one or more header fields, and an empty row and an optional message body that is just the end of the head field. HTTP header fields include universal headers, request headers, response headers, and entitiesThe first four parts. Each header field consists of a domain name, a colon (:), and a field value of three parts. Domain names are case-insensitive, field values can be added to any number of spaces, and header fields can be extended to multiple lines, at the beginning of each line, with at least one space or tab. The 1, Universal header domain Common header field contains the header fields supported by both request and response messages, and the Common header field contains Cache-control, Connection, Date, Pragma, transfer-encoding, Upgrade, Via. Extensions to the common header domain require both sides of the communication to support this extension, and if there are unsupported common header domains, they will normally be treated as entity headers. The following is a brief introduction to a few common header domains used in UPnP messages. The Cache-control header domain Cache-control Specifies the caching mechanism that the request and response follow. Setting Cache-control in a request message or in a response message does not modify the caching process during another message handling process. The cached instructions at request include No-cache, No-store, Max-age, Max-stale, Min-fresh, only-if-cached, and the instructions in the response message include public, private, No-cache, No-store, No-transform, Must-revalidate, Proxy-revalidate, 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 handled by the shared cache. This allows the server to simply describe a partial response message from the user, which is not valid for other users ' requests. No-cache indicates that a request or response message cannot be cached no-store used to prevent important information from being inadvertently published. Sending in a request message will not use caching for both request and response messages. 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 response times that are less than the current time plus a specified time. Max-stale indicates that the client can receive response messages that exceed 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. The Date Header field Date Header field indicates when the message was sent, and the description format of the time is defined by rfc822. For example, Date:mon,31dec200104:25:57gmt. When the time represented by the date represents the world standard, it is converted to local time and needs to know the time zone in which the user is located. The pragma header domain pragma header field is used to contain the implementation-specificInstructions, the most commonly used is pragma:no-cache. In the http/1.1 protocol, it has the same meaning as Cache-control:no-cache. 2, the first act of requesting a message request message The following format: Method sp Request-uri SP http-version CRLF methods represent the completion of Request-uri, which is case sensitive. Includes options,, POST, put, DELETE, TRACE. The method get and head should be supported by all common Web servers, and the implementation of all other methods is optional. The GET method retrieves the information identified by the Request-uri. The head method is also to retrieve the information identified by the Request-uri, except that the message body is not returned when responding. The Post method can request the server to receive entity information contained in the request, which can be used to submit the form and send messages to newsgroups, BBS, mail groups, and databases. The SP represents a space. Request-uri follows the URI format, which, when Cheweishing (*), describes the request not for a particular resource address, but for the server itself. Http-version represents a supported version of HTTP, for example, http/1.1. CRLF represents a line feed return character. The request header domain allows the client to deliver additional information about the request or about the client to the server. The Request header field may contain the following fields 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. The extension of the Request header field requires both communication support, and if an unsupported request header field exists, it will normally be treated as an entity header domain. Typical request message: Gethttp://class/download.microtool.de:80/somedata.exe Host:download.microtool.de accept:*/* Pragma: No-cache Cache-control:no-cache referer:http://class/download.microtool.de/ User-agent:mozilla/4.04[en] (win95;i; NAV) range:bytes=554554-The first line of the above example indicates that the HTTP client (possibly the browser, the download program) obtains the file under the specified URL through the Get method. The brown section represents the information for the Request header field, and the green section represents the generic head section. The Host Header domain host header field specifies the Intenet host and port number of the requesting resource, and must represent the location of the original server or gateway that requested the URL. The http/1.1 request must contain a host header domain or the system will return with a 400 status code. The Referer header domain referer header field 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 cache, and so on. He also permits the abolition or wrong connections to be tracked because of maintenance purposes. If the requested URI does not have its own URI address, Referer cannot be sent. If a partial URI address is specified, this address should be a relative address. The Range Header field Range header field can request one or more child scopes for an entity. For example, the first 500 bytes are represented: bytes=0-499 represents the Second 500 byte: bytes=500-999 represents the last 500 bytes: bytes=-500 represents 500 bytes after the range: bytes=500-the first and last bytes: bytes= 0-0,-1 specifies several scopes at the same time: bytes=500-600,601-999 but the server can ignore this request header, and if the unconditional get contains the range request header, the response is returned in status Code 206 (partialcontent) instead of (OK). The contents of the User-agent header domain user-agent header field contain the user information that makes the request. 3, the first act of responding to a message response message the following format: http-version sp status-code sp reason-phrase CRLF http-version represents the supported HTTP version, for example, http/1.1. Status-code is a three-digit result code. Reason-phrase provides a simple text description for Status-code. Status-code is mainly used for automatic machine 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 digits do not have a classification effect. The first number may be 5 different values: 1xx: The information response class, which represents receiving a request and continues processing 2xx: Processing a successful response class, indicating that the action isSuccessful reception, understanding and acceptance of the 3XX: Redirect Response class, in order to complete the specified action, must accept further processing 4xx: Client error, client request contains syntax error, or is not executed correctly 5xx: Server error, servers do not correctly execute a correct request The Response header field allows the server to pass additional information that cannot be placed in the status row, which mainly 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, Www-authenticate. The extension of the Response header field requires both communication support and, if an unsupported response header field exists, it will normally be treated as an entity header domain. Typical response message: Http/1.0200ok date:mon,31dec200104:25:57gmt server:apache/1.3.14 (Unix) content-type:text/html LAST-MODIFIED:TUE,17APR200106:46:28GMT Etag: "a030f020ac7c01:1e9f" content-length:39725426 Content-range: bytes554554-40279979/40279980 the first line of the example indicates that the HTTP server responds to a GET method. The brown section represents the Response header field information, the green section represents the generic header section, and the red section represents the information for the Entity header field. The location response Header location Response header is used to redirect the recipient to a new URI address. The server response Header server response header contains software information for the original server that processes the request. This field can contain multiple product identities and annotations, and product identities are generally sorted by importance. 4, Entity Information Request message and Response message can contain entity information, the entity information is generally composed of entity header domain and entity. The Entity header field contains the original information about the entity, and the entity headers include 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. Entities can beAn encoded byte stream that is encoded by content-encoding or content-type, and its length is defined by content-length or Content-range. Content-type Entity Header Content-type Entity header is used to indicate the media type of the entity to the receiver, specify the entity media type to which the head method is sent to the receiver, or the request media type sent by the Get method Content-range entity header The Content-range entity header is used to specify the insertion position of a portion 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 scope of the response coverage and the entire entity length. General format: Content-range:bytes-unit SP first-byte-pos-last-byte-pos/entity-legth For example, the form of a 500-byte secondary field for the transport header: Content-range: bytes0-499/1234 If an HTTP message contains this section (for example, a response to a range request or overlapping requests for a range of ranges), Content-range represents the range of delivery, Content-length represents the number of bytes actually transferred. Last-modified Entity Header last-modified Entity header specifies the last revision time for content saved on the server.
5. HTTP header Reference (Microsoft) HTTP requests and HTTP responses use headers to send information about HTTP messages. The header consists of a series of rows, each containing the name, followed by a colon, a space, and a value. Fields can be arranged in any order. Some header fields can be used for both the request header and the response header, while others can only be used for one of the header fields. Many request header fields allow clients to specify multiple acceptable options in the Value section, and sometimes even rank preferences for these options. Multiple items are separated by commas. For example, a client can send a request header containing "content-encoding:gzip, compress," to indicate that various types of compression can be accepted. If the response body of the server uses gzip encoding, the response header will contain "Content-encoding:gzip". Some fields can appear multiple times in a single header. For example, a header can have more than one "Warning" field. The following table lists the HTTP 1.1 header fields. Note: Some header fields are MIME fields. MIME fields are defined in the Internet Engineering Task Force (IETF) document RFC 2045, but can also be used for HTTP 1.1 protocols. For more information about the MIME and HTTP 1.1 specifications, see the Ieif page. General Header fields General header fields can be used to request messages and response messages. Name Sample value Cache-control "max-age=10" Connection "close" Date Tue, April 2000 18:23: Wuyi GMT " Pragma" No-cache " Trailer" Date " transfer-encoding" chunked " Upgrade "shttp/1.3" Via "http/1.1 Proxy1, http/1.1 Proxy2" Warning "112 Disconnected Operation" The Request header field Request header field is used only for request messages. Name Sample value Accept "text/html, IMAge/* " Accept-charset" iso8859-5 " accept-encoding" gzip, compress " accept-language" en, fr " Auth Orization [credentials] content-encoding "gzip" Expect "100-continue" from "use R@microsoft.com " Host" www.microsoft.com " If-match" entity_tag001 " if-modified-since "Tue, June 18:23:51 GMT" If-none-match "entity_tag001" If-range "entity_tag001" or "Tue, 11 June 18:23:51 GMT " if-unmodified-since" Tue, one June 18:23:51 GMT " max-forwards" 3 " Proxy-aut Horization [credentials] Range "bytes=100-599" Referer "http://www.microsoft.com/resources.asp" &nbs P TE "Trailers" user-agent "mozilla/4.0" (compatible; MSIE 5.5; Windows NT 5.0) >> the specific meaning of the request header field Accept: The MIME type acceptable to the browser. Accept-charset: A browser-acceptable character set. Accept-encoding: The data encoding method that the browser can decode, such as gzip. Accept-language: The kind of language the browser wants, when the server can provide more than one wordTo use when you speak a version. Authorization: Authorization information that usually occurs in response to a www-authenticate header sent to the server. Connec
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.