The header of the-http agreement in the interview record of the Fibonacci

Source: Internet
Author: User
Tags ranges

HTTP Request of the Header Information

1 , HTTP Request Method

As the following table:



Description:

Mainly used to "get" and "POST".

Instance:

POST/TEST/TUPIAN/CM http/1.1

into three parts:

(1) Post:http request method

(2)/TEST/TUPIAN/CM: Request the Directory address (or directive) of the Web server

(3) Http/1.1:uri (Uniform Resource Identifier, Uniform Resource Identifier) and its version

2 , Host

Description

The requested Web server domain name address

3 , user-agent

Description

Details of the browser type that the HTTP client is running. With this header information, the Web server can determine the client browser category to the current HTTP request.

Instance:

user-agent:mozilla/5.0 (Windows; U Windows NT 5.1; ZH-CN; rv:1.8.1.11) gecko/20071127 firefox/2.0.0.11

4 , Accept

Description

Specifies the types of content that clients can receive, and the order in which they are received in the content type indicates the order in which clients receive them.

For example:

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

Note:

In the AJAX Code encapsulation of Prototyp (1.5), the accept default is set to "Text/javascript, text/html, Application/xml, Text/xml, */*". This is because Ajax obtains the JSON data pattern returned by the server by default.

In AJAX code, you can use the setRequestHeader function method in the XMLHttpRequest object to dynamically set these header information.

5 , Accept-language

Description

Specifies the preferred language for the HTTP client browser to display the return information.

Instance:

accept-language:zh-cn,zh;q=0.5

This defaults to Chinese.

6 , accept-encoding

Description

Specifies that the Web server that the client browser can support returns the content compression encoding type. Indicates that the server is allowed to compress the output before it is sent to the client to conserve bandwidth. The return compression format that the client browser can support is set here.

Instance:

Accept-encoding:gzip,deflate

Note:

In fact, in many of Baidu's product lines, Apache compresses the data in gzip format before returning the page data to the client.

7 , accept- Charset

Description

The set of character encodings that the browser can accept.

Instance:

accept-charset:gb2312,utf-8;q=0.7,*;q=0.7

8 , Content-type

Description

Displays the content type submitted by this HTTP request. This property is typically only required for post submission.

Instance:

Content-type:application/x-www-form-urlencoded;charset:utf-8

There are two types of encoding available for the Content-type property values:

(1) "application/x-www-form-urlencoded": the type of encoding used when the form data is submitted to the server, the default value is "application/x-www-form-urlencoded". However, this encoding is inefficient when sending large amounts of text to the server, including text or binary data that contains non-ASCII characters.

(2) "Multipart/form-data": When the file is uploaded, the type of encoding used should be "Multipart/form-data", which can both send text data and support binary data upload.

You can use "application/x-www-form-urlencoded" when committing to data alone, and when you commit a file, you need to use the "multipart/form-data" encoding type.

The charset character encoding of the commit content is also specified in the Content-type property. Typically not set, it simply tells the Web server what character encoding to use for the data submitted by the post.

Generally in the development process, the front end works with the backend UI engineer to discuss what character encoding format to use for post submission, and then the backend UI engineer to parse the submitted data according to a fixed character encoding. So the charset set here does not have much effect.

9 , Connection

Description

Indicates whether a persistent connection is required. If the Web server side sees the value here as "keep-alive", or sees the request using an HTTP 1.1 (HTTP 1.1 By default for persistent connection), it can take advantage of the persistent connection, when the page contains multiple elements (such as applets, pictures), Significantly reduce the time it takes to download. To do this, the Web server needs to send a content-length (the length of the message body) header back to the client HTTP header, and the simplest implementation is to write the content to Bytearrayoutputstream first, and then Calculates the size of the content before it is formally written.

Instance:

Connection:keep-alive

Ten , keep-alive

Description

Displays the keep-alive time for this HTTP connection. The client-to-server connection continues to be valid, and the Keep-alive feature avoids establishing or re-establishing a connection when a subsequent request to the server occurs.

The previous HTTP request is a one-stop connection, and after the http/1.1 protocol, there is a long connection, that is, the connection is not broken within the specified keep-alive time.

Instance:

keep-alive:300

One , Cookies

Description

When an HTTP request is sent, all cookie values stored under that request domain are sent to the Web server.

A , Referer

Description

Contains a URL where the user accesses the currently requested page from the page represented by the URL

Responses part
Header explain Example
Accept-ranges Indicates whether the server supports the specified range request and what kind of staging request Accept-ranges:bytes
Age Estimated time (in seconds, non-negative) from the original server to the proxy cache Age:12
Allow A valid request behavior for a network resource is not allowed to return 405 Allow:get, HEAD
Cache-control Tell if all caching mechanisms can be cached and which type Cache-control:no-cache
Content-encoding The type of return content compression encoding supported by the Web server. Content-encoding:gzip
Content-language The language of the response body Content-language:en,zh
Content-length The length of the response body content-length:348
Content-location Alternate alternative address to request resource substitution Content-location:/index.htm
Content-md5 Returns the MD5 checksum value of a resource content-md5:q2hly2sgsw50zwdyaxr5iq==
Content-range The byte position of this section in the entire return body Content-range:bytes 21010-47021/47022
Content-type Returns the MIME type of the content content-type:text/html; Charset=utf-8
Date Time the original server message was issued Date:tue, 08:12:31 GMT
ETag The current value of the entity label of the request variable ETag: "737060cd8c284d8af7ad3082f209582d"
Expires Date and time when the response expires Expires:thu, 16:00:00 GMT
Last-modified Requested last modified time for resource Last-modified:tue, 12:45:26 GMT
Location Used to redirect the receiver to the location of the non-request URL to complete the request or identify the new resource Location:http://www.zcmhi.com/archives/94.html
Pragma Includes implementing a specific instruction that can be applied to any receiver on the response chain Pragma:no-cache
Proxy-authenticate It indicates the authentication scheme and the parameters on the URL that can be applied to the proxy Proxy-authenticate:basic
Refresh Applied to redirect or a new resource was created, redirected after 5 seconds (proposed by Netscape, supported by most browsers)

Refresh:5; Url=http://www.zcmhi.com/archives/94.html

Retry-after Notifies the client to try again after a specified time if the entity is temporarily undesirable retry-after:120
Server Web Server Software Name server:apache/1.3.27 (Unix) (Red-hat/linux)
Set-cookie Set HTTP Cookies Set-cookie:userid=johndoe; max-age=3600; Version=1
Trailer Indicates that the header domain is present at the end of the chunked transfer code Trailer:max-forwards
Transfer-encoding File transfer encoding Transfer-encoding:chunked
Vary Tells the downstream agent whether to use the cache response or request from the original server Vary: *
Via Tells the proxy client where the response was sent by via:1.0 Fred, 1.1 nowhere.com (apache/1.1)
Warning Warning about possible issues with the entity warning:199 Miscellaneous Warning
Www-authenticate Indicates the authorization scheme that the client request entity should use Www-authenticate:basic

The header of the-http agreement in the interview record of the Fibonacci

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.