A, problem,
1. How does the packet flow
2. Three parts of an HTTP packet
3. Difference between request and response messages
4. Various methods supported by request messages
5. Various status codes returned with the response message
What are the various HTTP headers used for
2. Packet flow
1. What are HTTP packets
HTTP packets are data blocks sent directly by HTTP applications. These data blocks begin with some meta-information in the form of text. This information describes the content and meaning of the message, followed by optional data sections. These packets flow directly through clients, servers, and proxies.
Common terms:Inflow, outflow, upstream, downstream
2. The packet flows to the source server
HTTP uses the terms inbound and outbound to describe the direction of a transaction. The packets are sent to the source server and then returned to the user Agent after the work is complete.
3. Packets flow downstream
HTTP packets flow like a river. All packets, whether they are request packets or response packets, are delivered downstream. The sender of all messages is upstream from the receiver.
For request packets, proxy 1 is upstream of Proxy 3. But for the response message, it is downstream of proxy 3.
3. Composition of the message
HTTP packets are simple formatted blocks of data. Each packet contains either a request from the client or a response from the server. They consist of three parts: description of packets
Start line, containing attributes
Header block, and optional, containing data
The bodyPart.
Start line, containing attributes
Header block, and optional, containing data
The bodyPart.
The beginning and beginning lines are ASCII text delimited by line delimiters. Each line ends with a two-character line termination sequence containing a carriage return (ASCII code 13) and a newline (ASCII code 10).
The body of an entity or the body of a message is an optional data block. Unlike the start line and header, the body can contain text or binary data, or it can be empty.
4. Syntax of the message
All HTTP packets can be divided into two types: Request message and Response message. The request message requests an action from the Web server. The response message returns the result of the request to the client. The basic mechanism of request and response packets is the same.
Format of the request packet
<method> <request-URL> <version> <headers<entity-body>
Format of the response packet
<version> <status> <reason-phrase> <headers<entity-body>
Five, the rounding
1. Start line
All HTTP packets start with a start line. The implementation of the request message is described
What to do. The start line of the response message indicates
What will happen.
What to do. The start line of the response message indicates
What will happen.
1) Request line
The request message asks the server to perform some operations on the resource. The opening line of the request message, or request line, contains a method that describes what the server should do and a request URL that describes which resource to perform the method on. The request line also contains the HTTP version, which tells the server which HTTP the client is using.
2) Response line
The response packet carries the status information and all the result data generated by the operation and sends it back to the client. The start line, or response line, of the response message contains the HTTP version used by the response message, the numeric status code, and the text reason phrase describing the operation status.
2, methods,
The opening line of the request starts with a method that tells the server what needs to be done.
3. Version number
The HTTP version used by the packet is in the following format:
HTTP/<major>.<minor>
The major and minor versions are integers.
4. Status Code
These three digits describe what happens during the request. The first digit of each status code is used to describe the general category of state (” success, “” error,” etc.).
There is no reason for the phrase.
A readable version of the numeric state that contains all text up to the line termination sequence.
6. Header
There can be zero or more headers, each containing a name followed by a colon (:), then an optional space, then a value, and finally a CRLF. Headers are terminated by a blank line (CRLF), indicating the end of the header list and the beginning of the body of the entity.
7. Entity-body
The topic portion of the entity contains a data block composed of arbitrary data. Not all messages contain the body part of the entity, and sometimes the message simply ends with a CRLF.