Hypertext Transfer Protocol refers to the HTTP protocol, a communication protocol based on "TCP/IP", a simple "request-response" protocol, which specifies what kind of content the client may send to the server message and what kind of response it gets; the headers of the request and response messages are given in ASCII form, while the message content has a MIME-like format. HTTP is an application layer protocol, which is a protocol for implementing a certain type of specific application, and its functions are implemented by an application running in user space.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
Hypertext Transfer Protocol refers to the HTTP protocol, a communication protocol based on "TCP/IP", a simple "request-response" protocol; It is used to provide World Almost all files and other data on the Wide Web are collectively called resources. These resources could be HTML files, image files, query results, or anything else.
The HTTP protocol specifies what kind of messages the client may send to the server and what kind of response it gets. The headers of request and response messages are given in ASCII form; the message contents have a MIME-like format. This simple model was responsible for the early success of the Web because it made development and deployment very straightforward.
The browser works as an HTTP client because the HTTP server that is called the web server sends the request. The web server then sends the response back to the client. The standard and default port that the HTTP server listens on is 80, but it can be changed to any other port like 8080, etc.
There are three important things you should know about HTTP:
HTTP is connectionless: when making a request, the client disconnects from the server and waits for a response. The server must re-establish the connection after it processes the request.
HTTP is media independent: any type of data can be sent as long as both the client and the server via HTTP know how to process the data content. A MIME specification that determines how content should be handled.
HTTP is stateless: this is a direct result of the HTTP connection. The server and client only know each other during a request. After that, each forgets about the other. For this reason, neither the client nor the browser can retain information across web pages between different requests.
HTTP is an application layer protocol. Like other application layer protocols, it is a protocol for implementing a certain type of specific application and is implemented by an application running in user space. Function. HTTP is a protocol specification. This specification is recorded in the document and is the implementation program of HTTP that actually communicates through HTTP.
HTTP communicates based on B/S architecture, and the server-side implementation programs of HTTP include httpd, nginx, etc. The client-side implementation programs are mainly web browsers, such as Firefox, Internet Explorer, Google Chrome, Safari, Opera, etc. In addition, client command line tools include elink, curl, etc. Web services are based on TCP, so in order to respond to client requests at any time, the Web server needs to listen on port 80/TCP. In this way, the client browser and the web server can communicate through HTTP.
Working principle:
HTTP is based on the client/server model and is connection-oriented. Typical HTTP transaction processing has the following process:
(1) The client establishes a connection with the server;
(2) The client makes a request to the server;
(3) The server Accept the request and return the corresponding file as a response according to the request;
(4) The client and server close the connection.
The HTTP connection between the client and the server is a one-time connection. It limits each connection to process only one request. When the server returns the response to this request, it immediately closes the connection and restarts the next request. establish connection. This one-time connection mainly takes into account that the WWW server faces thousands of users on the Internet and can only provide a limited number of connections. Therefore, the server will not leave a connection in a waiting state. Timely release of the connection can greatly improve the server's performance. effectiveness.
For more related knowledge, please visit the FAQ column!
The above is the detailed content of What is Hypertext Transfer Protocol. For more information, please follow other related articles on the PHP Chinese website!