Introduction to HTTP
HTTP protocol is the abbreviation of Hyper Text Transfer Protocol (Hyper Text Transfer Protocol), which is used to transmit hypertext from the World Wide Web (WWW: World Wide Web) server to the local browser. protocol. .
HTTP is a communication protocol based on TCP/IP to transfer data (HTML files, image files, query results, etc.).
HTTP working principle
The HTTP protocol works on a client-server architecture. As an HTTP client, the browser sends all requests to the HTTP server, that is, the WEB server, through the URL.
Web servers include: Apache server, IIS server (Internet Information Services), etc.
The Web server sends response information to the client according to the received request.
The default HTTP port number is 80, but you can also change it to 8080 or other ports.
Three things to note about HTTP:
HTTP is connectionless: connectionless means that each connection is limited to processing only one request. After the server processes the client's request and receives the client's response, it disconnects. This method saves transmission time.
HTTP is media independent: this means that any type of data can be sent over HTTP as long as the client and server know how to handle the data content. Clients and servers specify the appropriate MIME-type content type to use.
HTTP is stateless: The HTTP protocol is a stateless protocol. Stateless means that the protocol has no memory ability for transaction processing. The lack of status means that if subsequent processing requires the previous information, it must be retransmitted, which may result in an increase in the amount of data transferred per connection. On the other hand, the server responds faster when it does not need previous information.
The following diagram shows the HTTP protocol communication process: