I. Definition
HTTP is a hypertext transfer protocol that transfers hypertext from a Web server to a local browser.
Ii. Features
1. No connection: Each connection processes only one request. After the server processes the customer's request and receives the response from the client, the connection is closed. This method can save transmission time.
2. Stateless: stateless means there is no memory for transaction processing. This means that if subsequent processing requires the previous information, it must be re-transmitted, which may increase the amount of data transferred each time.
3. Independent Media: any type of data can be sent over HTTP as long as the client and the service network know how to process the data content,
Iii. HTTP message format
Request Message format of the Client: request line, request header, blank line, and request data.
GET/hello.txt HTTP/1.1 (request line) User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 (request header) Host: www. example. comaccept-language: En, mi
(Empty rows)
(Request data, such as when a POST request is sent)
Corresponding Message format on the server: Status line, message header, blank line, response body
HTTP/1.1 200 OK (status line) Date: Mon, 27 Jul 2009 12:28:53 GMT (message header) server: apachelast-modified: Wed, 22 Jul 2009 19:15:56 gmtetag: "34aa387-d-1568eb00" Accept-ranges: bytescontent-length: 51 vary: Accept-encodingcontent-type: text/plain
(Empty rows)
<HTML> (Response Message)
<Head>
<Title> Work homepage </title>
</Html>
Iii. http request methods
Get, post, Head, delete, put, etc.
Iv. Http status code
200 -- Request successful
301 -- Resource Transfer
404 -- requested resource does not exist
500 -- Internal Server Error
1 ×: the server receives the request and the requester must continue the operation.
2 ×: The operation has been processed successfully;
3××: redirection. Further operations are required to complete the request.
4××: client error. The request contains a syntax error or the request cannot be completed
5××: server error. The server encountered an error while processing the request.
Internet _ HTTP protocol