5. Request
Request-Header = Accept | Accept-Charset | Accept-Encoding | Accept-Language | Authorization | From | If-Modified-Since | Pragma | Referer | User-Agent | extension-headerAlthough additional request header fields may be implemented via the extension mechanism, applications which do not recognize those fields should treat them as Entity-Header fields.
The field may be folded onto several lines and more than one occurrence of the field is allowed (with the semantics being the same as if all the entries had been in one field value).
Accept = "Accept" ":" 1#( media-range [ ";" "q" "=" ( "0" | "1" | float ) ] [ ";" "mxb" "=" 1*DIGIT ] ) media-range = ( "*/*" | ( type "/" "*" ) | ( type "/" subtype ) ) *( ";" parameter ) float = < ANSI-C floating point text representation, where (0.0 < float < 1.0) >The parameter q is used to indicate the quality factor, which represents the user's preference for that range of media types, and the parameter mxb gives the maximum acceptable size of the Entity-Body (in decimal number of octets) for that range of media types. Section 9 describes the content negotiation algorithm which makes use of these values. If at least one Accept header is present, a quality factor of 0 is equivalent to not sending an Accept header field containing that media-type or set of media-types. The default values are: q=1 and mxb=undefined (i.e. infinity).
The example
Accept: audio/*; q=0.2, audio/basicshould verbally be interpreted as "if you have audio/basic, send it; otherwise send me any audio type."
If no Accept header is present, then it is assumed that the client accepts all media types with quality factor 1. This is equivalent to the client sending the following accept header field:
Accept: */*; q=1or
Accept: */*A more elaborate example is
Accept: text/plain; q=0.5, text/html, text/x-dvi; q=0.8; mxb=100000, text/x-cVerbally, this would be interpreted as "text/html and text/x-c are the preferred media types, but if they do not exist then send the Entity-Body in text/x-dvi if the entity is less than 100000 bytes, otherwise send text/plain".
Note
In earlier versions of this document, the mxs parameter defined the maximum acceptable delay in seconds before the response would arrive. This has been removed as the server has no means of obtaining a useful reference value. However, this does not prevent the client from internally measuring the response time and optimizing the Accept header field accordingly.
It must be emphasized that this field should only be used when it is necessary to restrict the response media types to a subset of those possible, to indicate the acceptance of unusual media types, or when the user has been permitted to specify qualitative values for ranges of media types. If no quality factors have been set by the user, and the context of the request is such that the user agent is capable of saving the entity to a file if the received media type is unknown, then the only appropriate value for Accept is "*/*" and the list of unusual types. Whether or not a particular media type is deemed "unusual" should be a configurable aspect of the user agent.
Accept-Charset = "Accept-Charset" ":" 1#charsetCharacter set values are described in Section 8.3. An example is
Accept-Charset: iso-8859-5, unicode-1-1The value of this field should not include "US-ASCII" or "ISO-8859-1", since those values are always assumed by default. If a resource is only available in a character set other than the defaults, and that character set is not listed in the Accept-Charset field, it is only acceptable for the server to send the entity if the character set can be identified by an appropriate charset parameter on the media type or within the format of the media type itself.
Note
User agents are not required to be able to render the characters associated with the ISO-8859-1 character set. However, they must be able to interpret their meaning to whatever extent is required to properly handle messages in that character set..
Accept-Encoding = "Accept-Encoding" ":" 1#( encoding-mechanism | transfer-encoding )An example of its use is
Accept-Encoding: compress, base64, gzip, quoted-printableThe field value should never include the identity transfer-encoding values ("7bit", "8bit", and "binary") since they actually represent "no encoding." If no Accept-Encoding field is present in a request, it must be assumed that the client does not accept any encoding-mechanism and only the identity transfer-encodings.
Accept-Language = "Accept-Language" ":" 1#language-tagThe language-tag is described in Section 8.2. Languages are listed in the order of their preference to the user. For example,
Accept-Language: dk, en-gbwould mean: "Send me a Danish version if you have it; else a British English version."
If the server cannot fulfill the request with one or more of the languages given, or if the languages only represent a subset of a multi-linguistic Entity-Body, it is acceptable to serve the request in an unspecified language.
Note
As intelligibility is highly dependent on the individual user, it is recommended that client applications make the choice of linguistic preference available to the user.
Authorization = "Authorization" ":" credentialsHTTP access authentication is described in Section 10. If a request is authenticated and a realm specified, the same credentials should be valid for all other requests within this realm.
From = "From" ":" addr-specAn example is:
From: webmaster@w3.orgThis header field may be used for logging purposes and as a means for identifying the source of invalid or unwanted requests. It should not be used as an insecure form of access protection. The interpretation of this field is that the request is being performed on behalf of the person given, who accepts responsibility for the method performed. In particular, robot agents should include this header so that the person responsible for running the robot can be contacted if problems occur on the receiving end.
The Internet e-mail address in this field does not have to correspond to the Internet host which issued the request. (For example, when a request is passed through a proxy, then the original issuer's address should be used). The address should, if possible, be a valid Internet e-mail address, whether or not it is in fact an Internet e-mail address or the Internet e-mail representation of an address on some other mail system.
Note
The client should not send the From header field without the user's approval, as it may conflict with the user's privacy interests or their site's security policy. It is strongly recommended that the user be able to disable, enable, and modify the value of this field at any time prior to a request.
If-Modified-Since = "If-Modified-Since" ":" HTTP-dateAn example of the field is:
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMTThe purpose of this feature is to allow efficient updates of local cache information with a minimum amount of transaction overhead. The same functionality can be obtained, though with much greater overhead, by issuing a HEAD request and following it with a GET request if the server indicates that the entity has been modified.
no-cache
" directive.
Pragma = "Pragma" ":" 1#pragma-directive pragma-directive = "no-cache" | extension-pragma extension-pragma = tokenWhen the "
no-cache
" directive is present, a caching proxy must forward the request toward the origin server even if it has a cached copy of what is being requested. This allows a client to insist upon receiving an authoritative response to its request. It also allows a client to refresh a cached copy which has become corrupted or is known to be stale.Pragmas must be passed through by a proxy even when they have significance to that proxy. This is necessary in cases when the request has to go through many proxies, and the pragma may affect all of them. It is not possible to specify a pragma for a specific proxy; however, any pragma-directive not relevant to a gateway or proxy should be ignored.
Referer = "Referer" ":" URIExample:
Referer: http://info.cern.ch/hypertext/DataSources/Overview.htmlIf a partial URI is given, it should be interpreted relative to the Request-URI.
Note
Because the source of a link may be considered private information or may reveal an otherwise secure information source, it is strongly recommended that the user be able to select whether or not the Referer field is sent. For example, a browser client could have a toggle switch for browsing openly/anonymously, which would respectively enable/disable the sending of Referer and From information.
User-Agent = "User-Agent" ":" 1*( product ) product = token ["/" product-version] product-version = tokenExample:
User-Agent: CERN-LineMode/2.15 libwww/2.17b3Product tokens should be short and to the point -- use of this field for advertizing or other non-essential information is explicitly deprecated and will be considered as non-conformance to the protocol. Although any token character may appear in a product-version, this token should only be used for a version identifier (i.e., successive versions of the same product should only differ in the product-version portion of the product value). The User-Agent field may include additional information within comments that are not part of the value of the field.
Note
Some current proxy applications append their product information to the list in the User-Agent field. This is no longer recommended, since it makes machine interpretation of these fields ambiguous. Instead, proxies should use the Forwarded header described in Section 4.3.2.
Generated with CERN WebMaker