HTTP protocol (eight) request header field

Source: Internet
Author: User

Company server hangs, intermittent no work, take the time to more recent finishing notes ...

Request Header Field

Definition: The Request header field is the field used in sending request messages from the client to the server, which contains additional information, client information, and the priority associated with the response content.

1. Accept

Notifies the server user agent of the relative priority of the media types and media types that can be handled, using the form Type/subtype to specify multiple media types at once

accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Q represents the weight, the default value is 1.0, when the server provides a variety of content, will have priority to return the highest weight value of the media type

Here are a few examples:

Text file:

Text/html,text/plain,text/css ...

Application/xhtml+xml,application/xml ...

Picture file:

Image/jpeg,image/gif,image/png ...

Video files:

Video/mpeg,video/quicktime ...

Binary files used by the application

Application/octet-stream,application/zip ...

2, Accept-cherset

Notifies the server user agent of the relative priority of the character set and character set that can be specified at one time.

The header field can use the weight Q value to represent the relative priority level

The header field is applied to the server-driven negotiation of the content negotiation mechanism

Accept-charset:iso-8859-5, unicode-1-1;q=0.8

3, Accept-encoding

Tells the server user agent support content encoding and content encoding priority order, can specify a variety of content encoding at once

Accept-encoding:gzip, deflate

Several encoding formats are commonly used:

GIZP: Encoded format generated by the file compression program gzip (GUN Zip)

Compress: Encoded format generated by the UNIX file compression program compress

Deflate: Combining the zlib format with the encoding format generated by the deflate compression format

Jdentity: does not perform compression or does not change the default encoding format

Similarly, you can use the Q value to indicate a relative priority, or you can use (*) as a wildcard character to specify any encoding format

4, Accept-lanuage

Informs the server user agent of the natural language set that can be handled, as well as its relative finite set, which can specify multiple natural language sets at once

You can also use the weight value Q to indicate relative precedence

accept-lanuage:zh-cn,zh;q=0.7,en=us,en;q=0.3

5, Authorization

Informs the server user agent of the authentication information (certificate value).

The user agent who usually wants to be authenticated will change the initial field into the request after accepting the 401 status Code response for the first return, and the common cache will differ when it receives the request containing the field.

6, Expect

The client uses this field to tell the server that a specific behavior is expected to occur

If the server does not understand the expected response and an error occurs, it returns a status code of 417Expect Failed, which the client can use to indicate the desired extension

The http/1.1 specification value defines the 100-continue (meaning of the turntable 100Continue)

Expect:100-continue

7. From

Notifies the server to use the user agent's user pad email address

Purpose: To show the email contact of the owner of the user agent such as search engine

From: [Email protected]

8. Host

Tells the server the Internet host name and port number where the requested resource is located

The Host header field is the only header field within the http/1.1 specification that must be included in the request

Host:www.baidu.com

9, If-match

The request header field, such as if-xxx, can be called a conditional request, and the server receives the request, and the request is executed only if the condition is true

This field tells the server to match the entity tag (ETAG) value used by the resource, and the weak ETag value cannot be used

Returns a 412Precondition failed response if the condition is not true

You can also use (*) to specify If-match field values, in which case the server ignores the ETag value and processes the request as long as the resource exists

If-match: "123456"

10, If-modified-since

conditional request, tells the server if the field specifies a value earlier than the resource update time, you want to be able to process the request if the date time specified in the field is greater than the resource update time , the 304Not modified response is returned

A message that confirms the local resources owned by the agent or client

If-modified-since:thu, APR 2004 00:00:00 GMT

11, If-none-match

The conditional request, contrary to the if-match effect. Tells the server to process the request when the entity tag (ETag) Value of the field value is inconsistent with the etag of the requesting resource

Use this field in the Get or head method to get up-to-date resources

12, If-range

A conditional request that informs the server that if the value specified is the same as the requested resource, it is processed as a range request and, conversely, all resources are returned

Request:response:

Get/index.html 206 Partial Content

If-range: "123456" Content-range:bytes 5001-10000/10000

range:bytes=5001-10000 content-length:5000

The above request and resource match are consistent, so long as the range request processing

13, If-unmodified-since

A conditional request, which is in contrast to the If-unmodified-since field, to inform the server that the specified request resource can process the request only after the date specified in the field value has not been updated.

Returns 412 precondition failed as a response if an update occurs after the specified time

If-unmodified-since:thu, 00:00:00 GMT

14, Max-forwards

We all know that when using HTTP protocol communication, the request may go through multiple servers such as proxy, if for some reason the request forwarding failed, then the client received no response, we do not know

When you send a request that contains this field through the trace or Options method, the field specifies the maximum number of servers that can be passed in decimal integers

In simple terms, it is the value of the specified max-forwards, and each time it is forwarded, it is-1. The values change to 0. Direct return response

Max-forwards:10

15, Proxy-authorization

When you receive the authentication challenge from the proxy server, the client sends a request with the header field to the proxy server to inform the server about the authentication required

Proxy-authorization:basic dGLwoPNLAGKGFY5

16. Range

For a range request that requires only a subset of the resources, include the header field range to tell the server resource the specified range

A server with a range field is received, and a response of 206Partial content is returned, and when the request is not processed, the response and all resources are returned with a OK.

range:bytes=5001-10000

17, Referer

URI that tells the server to request the original resource

Referer:www,baidu.com/index.xml

18. TE

Tells the server client how to handle the transmission encoding and relative priority of the response

Te:gzip, deflate;q=0.5

This field can also specify how the chunked transfer encoding accompanies the trailer field

Te:trailers

19, User-agent

This field will pass information such as the browser that created the request and the user agent name to the server

If the request is initiated by a web crawler, the crawler's mat email address may be added to the request. Therefore, if the request is proxied, the middle is likely to be added on the proxy server name

user-agent:mozilla/5.0 (Windows NT 6.1; WOW64; rv13.0) gecko/=20100101 firfox/13.0.1

HTTP protocol (eight) request header field

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.