A user's online process
What did the user go through when they opened the browser input URL to see the page?
1. You must first run the Web server
2. Client running browser software
3. User Input http://www.sina.com.cn/
4. The client browser handles http://www.sina.com.cn/, initiates a query for local DNS operations, and www.sina.com.cn->202.103.0.33
5. The client browser sends an HTTP request http://202.103.0.33:80/index.html (Note: 80 is the default port for the Web server, index.html is the default requested resource)
6. The server-side Web service receives the request header for the HTTP, gets the client's method from the request header, get/post.../index.html the path, and other information about the client request
7. Server-side Web service reply to Respone response header based on the information obtained
The response header contains:
Response code: 200 indicates success, 3xx indicates redirection, 4xx indicates that the client sent a request error, 5xx indicates server-side processing error occurred;
Response type: specified by Content-type;
and other relevant headers;
Usually the server's HTTP response will carry content, that is, a body, containing the content of the response, the HTML source of the Web page is in the body, compressed and returned to the client.
8. The client browser receives the data from the server, parses the HTML content after decompression, and the user sees the content of the Web page.
Other links may be nested within 9.html, such as images, videos, javascript scripts, Flash, etc., and the client browser will continue to initiate HTTP requests to get them. So the pressure from the picture and video is scattered to the various servers, a site by countless sites connected to each other, the formation of the world Wide Web, referred to as www.
In fact, it's an HTTP request-response process.
We can open the browser in the menu to choose "View", "Developer", "Developer Tools", select Network to monitor the browser and the Web server to do things.
Introduction to the two HTTP protocols
The Web server is the socket service side, the browser is the socket client, this is called B/s architecture, the standard of communication between B and S is the HTTP protocol (currently version 1.1, better than 1.0 can allow multiple HTTP requests to re-use a TCP connection)
The request headers that the Web server receives from the client
The response header that the Web server sends to the client (returns to the body is HTML)
The browser sends an HTTP request;
The server receives the request and generates an HTML document;
The server sends the HTML document as the body of the HTTP response to the browser;
The browser receives an HTTP response, removing the HTML document from the HTTP body and displaying it.
A static page and a dynamic page
Early users were accessing static pages and what were static pages? That's the same for everyone.
Keystone Series II: Gateway Protocol CGI,FASTCGI,WSGI,UWSGI