Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTTP Tutorial

HTTP Tutorial


HTTP (HyperText Transfer Protocol) is an application-layer protocol for distributed, collaborative, hypermedia information systems.

HTTP is the foundation of data communication on the World Wide Web (WWW). It is designed to ensure communication between clients and servers and is one of the most commonly used protocols on the Internet.

HTTP is a communication protocol based on TCP/IP for transmitting data (HTML files, image files, query results, etc.).

The original purpose of designing HTTP was to provide a method for publishing and receiving HTML pages. Resources requested via the HTTP or HTTPS protocol are identified by Uniform Resource Identifiers (URIs).


HTTP request-response

The basic working principle of HTTP is that a client (usually a web browser) sends a request to a server, and the server returns the corresponding resource after receiving the request. These resources can be web pages, images, audio files, videos, etc.

HTTP uses a client-server model, in which the client sends requests and the server returns responses.

The HTTP request-response model usually consists of the following steps:


HTTP methods

HTTP methods specify what actions the client can perform on resources on the server.

The main HTTP methods are:


HTTP Status Codes

HTTP status codes are the server's response to client requests.

Status codes are divided into five classes:


HTTP version

HTTP has multiple versions; currently the widely used ones are HTTP/1.1 and HTTP/2, with HTTP/3 gradually being adopted.

Safety


HTTP itself is insecure because the transmitted data is unencrypted and may be eavesdropped on or tampered with. To solve this problem, HTTPS was introduced (explained in detail in the next chapter), which adds the SSL/TLS protocol on top of HTTP, providing encryption and authentication for data transmission.