HTTP message structure


Release date:2024-02-22 Update date:2024-02-23 Editor:admin View counts:232

Label:

HTTP message structure

HTTP is a client / server-based architecture model that exchanges information through a reliable link and is a stateless request / response protocol.

An HTTP “client” is an application (Web browser or any other client) that connects to the server to send one or more HTTP requests to the server.

A HTTP “server” is also an application (usually a Web service, such as an Apache Web server or IIS server, etc.) by receiving requests from the clientand sending HTTP response data to the client.

HTTP uses uniform resource identifiers (Uniform Resource Identifiers, URI) to transfer data and establish connections.

Once the connection is established, the data message is in a format similar to that used by Internet mail [RFC5322] And Multi-purpose Internet Mail extensions (MIME) [RFC2045] To transmit.

Client request message

The request message that the client sends a HTTP request to the server includes the following format: request line (request line), request header (header), blank line and request data. The following figure shows the general format of the request message.

Image0

Server response message

The HTTP response also consists of four parts: the status line, the message header, the blank line, and the response body.

Image1

Example

The following example is a typical use of GET to pass an example of data:

Client request:

GET /hello.txt HTTP/1.1
User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
Host: www.example.com
Accept-Language: en, mi

Server response:

HTTP/1.1 200 OK
Date: Mon, 27 Jul 2009 12:28:53 GMT
Server: Apache
Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
ETag: "34aa387-d-1568eb00"
Accept-Ranges: bytes
Content-Length: 51
Vary: Accept-Encoding
Content-Type: text/plain

Output result:

Hello World! My payload includes a trailing CRLF.

Powered by TorCMS (https://github.com/bukun/TorCMS).