Graphical HTTP reading notes (HTTP messages within three HTTP messages)

Source: Internet
Author: User
Tags character set
http information in three HTTP messages 3.1 Message structure:

Message header + blank line (CR+LF) + message body

First content:

Request line: Used to include the requested method, request URI, and HTTP version

Status line: Contains status codes, reason phrases, and HTTP versions that indicate the result of the response.

Header field: Various properties that represent the various conditions and properties of the request and response.

Other: Cookies, etc.


3.2 Encoding increases transfer rate

the difference between the message body and the entity body

The message (message) is the basic unit of HTTP communication and consists of 8-bit byte streams, which are transmitted over HTTP traffic.

Entities (entity) are transmitted as payload data for requests or responses, and their contents consist of entity headers and entity bodies.

The body of an HTTP message is used to transmit the entity body of the request or response. Usually the message body is equal to the entity body, and the body content of the entity changes when the transmission is encoded, which results in the difference of the main message body.

content encoding for compressed transmissions

The content encoding indicates the encoding format applied to the entity content and keeps the entity information compressed. After the content is compressed, the entity content is accepted by the client and is responsible for decoding.

There are several common content encodings:

Gzip (GNU Zip), Compress (Unix standard compression), deflate (zlib), identity (not coded)

chunked transfer encoding for split sending

Splitting the transfer encoding divides the entity body into sections (blocks), each with a hexadecimal tag block, and the last chunk of the entity is marked with 0 "CR+LF". Entity principals that use chunked transfer encoding will have the client responsible for receiving decoding, reverting to the entity body before encoding. 3.3 Multi-part object collection for sending multiple data

Usually when a picture or text file is uploaded, a message body that is sent may contain multiple types of entities.

The multi-part object collection contains the following objects:

Multipart/form-data

Used when uploading a Web Form file.

Multipart/byteranges

Status Code 206, the response message contains multiple scopes of content usage.

When using multi-part object collections for HTTP messages, you need to add Content-type to the header field. 3.5 getting a range request for partial request content

Never met, skip first. 3.6 Content Negotiation

The author takes a visit to Google as an example, introducing different content negotiation for different presentation content in the browser's default language.

The content negotiation mechanism is the client and the server to negotiate the content of the response, and then provide the most appropriate resources to the client. Content negotiation is judged in response to the language of the resource, the character set, the encoding method, and so on.

Some of the header fields contained in the request message are as follows: Judging criteria

Accept:

Accept-language:

Accept-encoding:

Accept-charset:

Content-language:

The negotiation mechanism is server-driven, client-driven, transparent driver (server + client)

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.