HTTP request header and corresponding header analysis

Source: Internet
Author: User

"Begonia" Su Shi

East Wind Curl Pan Chong Guang, fragrant fog klong Muang month turn corridor;

Only fear the night to sleep, so burn high candle gongzhuang.

1.Http Request Header:

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

The request MIME types supported by the browser are text/html, Application/xhtml+xml, Application/xml, and */*, respectively, and the order of precedence is their left-to-right ordering

Detailed

Accept indicates the MIME type supported by the browser;

The English full name of MIME is Multipurpose Internet Mail Extensions (multi-functional Internet messaging extension), a multipurpose e-mail expansion protocol that was first applied to the email system in 1992, but was later applied to the browser.

Text/html,application/xhtml+xml,application/xml are both MIME types, which can also be called media types and content types, preceded by type (type), and subtype (subtype) followed by a slash. Type Specifies a large range, subtype is a more explicit type within a range, which is a small class in a large class.

Text: Used to standardize the representation of textual information, text messages can be a variety of character sets and or multiple formats;

Text/html: Represents an HTML document;

Application: Used to transfer application data or binary data;

Application/xhtml+xml: Represents an XHTML document;

Application/xml: Represents an XML document.

1.2 Accept-encoding:gzip, deflate

  Meaning: The compression encoding supported by the browser is gzip and deflate.

  Detailed

Accept-encoding indicates the type of encoding that the browser has the ability to decode;

GZIP is the abbreviation for GNU Zip, which is a file compression program for GNU Free Software and is often used to represent the gzip file format.

Deflate is a lossless data compression algorithm that uses both the LZ77 algorithm and Huffman coding (Huffman Coding).

1.3 accept-language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3

  Meaning: The language supported by the browser is Chinese and Simplified Chinese, which is preferred for Simplified Chinese.

1.4 connection:keep-alive;

  Connection represents the client and service connection type;

Keep-alive indicates a persistent connection;

If the servlet sees the value here as "keep-alive", or sees the request using an HTTP 1.1 (HTTP 1.1 is persistent by default), 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 servlet needs to send a content-length header in the answer, and the simplest implementation is to write the content to Bytearrayoutputstream first and then calculate its size before formally writing the content.

1.5 COOKIE:JSESSIONID=2B5F5F6380CA6339CEF98AD9A9E95AB4

  Cached SessionID and cached in the browser, there is no cache is unable to implement session-related functions.

1.6 host:localhost:8080

  Host represents the requested server URL;

1.7 user-agent:mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:55.0) gecko/20100101 firefox/55.0

  Meaning: The user agent used is mozilla/5.0 (compatible; domain name).

1.8 Pragma

Specifying a "No-cache" value means that the server must return a refreshed document, even if it is a proxy server and has a local copy of the page, which is commonly used to disallow caching.

2. HTTP response Header

  2.1 CONTENT-LANGUAGE:ZH-CN

  Response language type, Chinese Simplified

2.2 content-length:317

  The length of the content of the response

2.3 Content-type:text/html;charset=utf-8

  Responding to specific MIME types

2.4 Date:thu, Sep 2017 14:34:35

  Response time

2.5 gmtserver:apache-coyote/1.1

  Server type of response

2.6 http/1.1-OK

  Status code of the response

Detailed

In this example, the status line gives the HTTP status code of 200, and the message OK. The status line always contains a status code and a corresponding short message to avoid confusion. The most commonly used status codes are:
(OK): The resource was found and everything is OK.
304 (not MODIFIED): The resource has not been modified since the last request. This is commonly used for browser caching mechanisms.
401 (Unauthorized): The client does not have permission to access the resource. This usually causes the browser to require the user to enter a user name and password to log on to the server.
403 (FORBIDDEN): Client failed to get authorization. This is usually followed by an incorrect user name or password that was entered after 401.
404 (Not FOUND): The requested resource does not exist at the specified location.

$: Server exception.

HTTP request header and corresponding header analysis

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.