Request header fields
Header field of the request from the client to the server sends a request message fields used for the additional supplementary information request, client information, content-related response to the priority and so on.
Accept
Accept header field to notify the server, the user agent relative priority of media types, and media types that can be processed. You can use type / subtype this form, specify a variety of media types.
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Following is several common types of media:
- Text File
text / HTML, text / Plain, text / CSS ...
the Application / XHTML + xml, the Application / xml ... - Picture file
image / jped, image / gif, image / png ... - Video file
video / mpeg, video / quicktime ... - Binary files used by the application
application / octet-stream, application / zip ...
To give the display
Accept-Charset
Accept-Charset: iso-8859-5,unicode-1-1;q=0.8
The relative priority Accept-Charset header field can be used to inform the user agent server supports the character set and character set. Further, a variety of characters can be specified at once. Accept header field with the same value of q weights are available to indicate the relative priority.
The header fields used in server-driven content negotiation mechanism for consultation.
Accept-Encoding
Accept-Encoding:gzip,deflate
Accept-Encoding header field is used to inform the user agent server, and content encoding supports content encoding priority order. Content encoding can specify various disposable.
Here are some common content encoding:
- gzip
program gzip generated by the file compression encoding format, using Lempel-Ziv algorithm and 32-bit cyclic redundancy check - compress
program compress generated by the UNIX file compression encoding format, using Lempel-Ziv-Welch algorithm (the LZW) - deflate
combination zlib format and algorithms generated by the deflate compression encoding format - identity
does not perform or does not change the default compression encoding format
using the value q represents the weight relative priority, this is the same as the Accept header field. Alternatively, you can use the asterisk (*) as a wildcard, specify any encoding format.
Accept-Language
Accept-Language:zh-cn,zh;q=0.7,en-us,en;q=0.3
Accept-Language header field is used to inform the user agent set of natural languages can be processed by the server (refer to Chinese or English, etc.), and the relative priority of the set of natural languages. You can specify a variety of natural language sets.
In the embodiment, the client in the Chinese version server resources, the request will return a response corresponding to the Chinese version, the absence of Chinese, English version of the request returns a response.
Authorization
Authorization:Basic dWVub3N1bjpwYXnZD29Yza==
Authorization header field is used to inform the server, the user agent authentication information (certificate value).
Request packet:
GET /index.htm
Returns the validation requirements:
401 Unauthorized
WWW-Authenticated:Basic ...
Send authentication information:
GET /index.htm
Authorization:Basic dWVub3N1bjpwYXnZD29Yza==
Except
Except:100-continue
The client uses the header fields Except to tell the server, you expect certain behaviors occur.
From
From:[email protected]
From header field is used to inform the server using the user's e-mail address of the user agent. In general, the purpose is to use search engines to display the person in charge of the e-mail user agent contact information.
Host
Host:www.baidu.com
Virtual hosts running on the same IP, this time using the header field Host distinction.
Host header field in the HTTP / 1.1 specification is the only header fields must be included in the request.
If-Match
GET /index.html
If-Match:"123456"
The server than the ETag value field values and resources of the If-Match, only when both are coincident, will perform the request.
Entity tag (the ETag) determining a value associated with a particular resource. ETag will be updated after the resource update.
If-Modified-Since
Request packet:
GET /index.htm
If-Modified-Since:Thu,15 Apr 2004 00:00:00 GMT
If the resource updated in 2004 after April 15, the return
200 OK
Last-Modified:Sun,29 Aug 2004 14:03:05 GMT
If the resource is not updated after the April 15, 2004, the return
304 Not Modified
If-None-Match
Request packet:
PUT /sample.html
If-None-Match: *
If there is no match ETag, returns
200 OK
Only when the If-None-Match ETag field values and values do not match, the request may be processed. In contrast to the role of If-Match header field.
If-Range
This header field tells the server if the specified field values If-Range (ETag value or time) and time resources or request the ETag value coincides, as the scope of the request processing. On the contrary, all the resources are returned.
Especially in the case of a mismatch, saving request resources without having to re-send the request, if the If-Match is the need to re-send the request to get the latest resources.
If-Unmodified-Since
If-Unmodified-Since:Thu,03 Jul 2012 00:00:00 GMT
Opposite effect header field and If-Unmodified-Since header field of the If-Modified-Since. Its role is to inform the server after a specified resource request only the specified date and time value in the field, case update has not occurred, in order to process the request.
Max-Forwards
Max-Forwards:10
TRACE OPTIONS method or by a method, comprising transmitting Max-Forwards header field of the request, the server can specify the maximum number field after the decimal integer.
Down a server before forwarding the server request, the value of Max-Forwards will be re-assigned after the decrement. When the server receives a request Max-Forwards value is 0, then no further forward, but directly returns a response.
Max-Forwards may also be used to observe the communication state of the transmission path to a server to end.
Proxy-Authorization
Proxy-Authorization: Basic dG1w0jkpNLGAFDFIJ
Upon receiving the server sent from the proxy authentication challenge, the client transmits a Proxy-Authorization header field of the request, to inform the server authentication key information needed.
The authentication takes place between the client and the agency. Authentication between the client and the server, using the Authorization header field may serve the same function.
Range
Range:bytes=5001-10000
The above example indicates a request for access to resources from the 5001 byte to 10000 bytes.
Receiving server comes Range header field of the request, the request will be returned after processing in response to a status code of 206 Partial Content. When the above range can not process the request, 200 OK response and all resources will return a status code.
Referer
GET /
Referer:http://www.hackr.jp/index.htm
Referer header field tells the server requests the original resource URI.
The client usually send Referer header field to the server.
TO
TE:gzip,deflate;q=0.5
TE header field tells the client to the server process in response to a transmission encoding and relative priority. It Accept-Encoding header fields like features, but coded for transmission.
User-Agent
User-Agent:Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Mobile Safari/537.36
User-Agent header field will create the requesting browser and user agent name and other information to the server.