HTTP information Chapter HTTP packets

 

HTTP information Chapter HTTP packets

 

HTTP communication process: Client - "server, the server -" client.

1.HTTP message

  Interaction information using the HTTP protocol is called HTTP packets, including the request packet and response packet.

  [ Request packet and response packet structure ] message header ( request line / row corresponding header field + <Request, Response, GM, entity header field> ) + message body

 

 

 2. The message encoding

  HTTP data transmission can be efficiently handle a large number of access requests by an encoding technique, but consumes more CPU resources.

  [ Packets and physical ] message box is, HTTP is the basic unit of communication, 8-bit byte stream consisting of the group, through the HTTP transport. Entity of goods, as a request or response data payload. Message entity is an entity header and the main component of an entity. Under normal circumstances, the message body is equal to the entity body. However, when the transmission process of the encoding operation, the contents of entity body changes, and a difference in the message body.

  [ Compression and transmission of content encoded ] content encoding format specified in the application code of the substantial contents, and holding entity information as compressed. After the content is encoded by the entity receiving the client and is responsible for decoding. Common Content encoding: gzip, compress (UNIX standard compression system), deflate, identity.

  [ Split transmitted chunked transfer encoding ] The data is divided into multiple pieces, allowing gradual browser display page. Finally, the use of an entity 0 (CR + LF) is identified.

  [ Transmit data to multiple multi-part set of objects on a transmission entity that contains different types of data, such as e-mail attachments can add text, audio, video, etc. At the same time, which is the use of MIME (Multipurpose Internet Mail Extensions) mechanism. Accordingly, HTTP protocol also adopted a multi-part collection of objects, messages sent in the body of a variety of types of entities, typically used when uploading images or text and so on. When using multi-part collection of objects in HTTP packets, you need to add in the header field Content-type, and using the boundary string to divide the multi-part objects of various types of entities.

  Object multi-part collection contains the following objects:

      multipart / form - the Data: When using the Web form file upload

      multipart / byteranges: status code response message 206 contains the contents of a plurality of ranges is used.  

  [ Acquiring part of the scope of the request ] to be requested to specify the range of the transmission request is called range request. For example, a resource size of 10000 bytes, if requested scope, may refer to the resources request 5001 to 10000 bytes.

  Range: bytes = 5001-10000 5001-10000 bytes requested

  Range: bytes = 5001- After all requests 5001 bytes

  Range: bytes = -3000,5001-7000 a request to start the 3000 and 5001-7000

 

  [ Content negotiation returns the most appropriate content ] content negotiation mechanism refers to the client and server to negotiate on the appropriate resources, and then provided to the client the most appropriate resource. Contains some header fields in the request packet is the determination reference.

  Content negotiation technology has the following three types: server-driven negotiation, client-driven negotiation, transparent negotiation.

Guess you like

Origin www.cnblogs.com/qmillet/p/12075369.html