Several uses of HTTP request methods
- The GET method
Sends a request to retrieve a resource on the server
- POST method
Submits data or appends new data to the resource specified by the URL
- PUT method
Much like the POST method, it wants to submit data to the server. But there are differences. PUT specifies the location of the resource on the server, whereas POST does not
- The HEAD method
Only the header of the page is requested
- The DELETE method
Example Delete a resource on the server
- The OPTIONS method
It is used to get the methods supported by the current URL. If the request is successful, there is an Allow header that contains information like “GET,POST”
- The TRACE method
The TRACE method is used to fire a remote, application-level request message loop
- The CONNECT method
Convert the request connection to a transparent TCP/IP channel
Enter the URL from the browser address bar to display the page
Basic version
- The browser sends the requested URL to the DNS for domain name resolution, finds the real IP address, and sends a request to the server.
- The server to the background processing completed after the return of data, browser to receive files (HTML, JS, CSS, images, etc.);
- The browser parses the loaded resources (HTML, JS, CSS, etc.) and establishes the corresponding internal data structure (such as HTML DOM).
- Load the parsed resource file, render the page, and finish.
Lite version
- From the browser receiving the URL to the network request thread (this part can expand the mechanism of the browser and the relationship between the process and thread)
- Start the network thread to issue a complete HTTP request (this part covers DNS query, TCP/IP request, layer 5 Internet protocol stack, etc.)
- Requests received from the server to the corresponding backend (this part may involve load balancing, security interception, internal backend processing, etc.)
- HTTP interaction between background and foreground (this part includes HTTP header, response code, packet structure, cookie and other knowledge, which can be used for cookie optimization of static resources, as well as encoding and decoding, such as Gzip compression)
- HTTP cache headers, ETag, catchcontrol, etc.
- The parsing process of HTTP data packets received by the browser (parsing HTML-lexical analysis and then parsing into DOM tree, parsing CSS to generate CSS rule tree, merging into render tree, Then layout, painting and rendering, composite layer composition, GPU rendering, processing of external chain resources, loaded and DOMContentLoaded, etc.)
- Visual formatting model of CSS (rules for rendering elements, such as inclusion block, controller enclosure, BFC, IFC, etc.)
- JS engine parsing process (JS interpretation stage, preprocessing stage, execution stage to generate execution context, VO, action domain chain, recycle mechanism, etc.)
- Others (can expand different knowledge modules, such as cross domain, Web security, Hybrid mode, etc.)
HTTP status code and its meaning
- 1XX: indicates the information status code
100 Continue When a POST request is sent, the server sends an acknowledgement message after the HTTP header has been sent, and then sends specific parameter informationCopy the code
- 2XX: success status code
200 OK Normal information Is returned. 201 Created The request succeeds and the server creates a new resourceCopy the code
202 Accepted the request has been Accepted but not yet processedCopy the code
- 3XX: redirection
301 Moved Permanently The page for the Permanently Moved Permanently to the new location.Copy the code
302 Found Temporary redirect.Copy the code
303 See Other Temporary redirects and always uses GET to request new URIs.Copy the code
The requested page has Not been Modified since the last request.Copy the code
- 4XX: Client error
400 The Bad Request server cannot understand the format of the Request. The client should not use the same capacity to initiate a Request again.Copy the code
401 Unauthorized The request is not authorized.Copy the code
403 Forbidden Forbidden access.Copy the code
404 Not Found The resource how to match the URI was Not Found.Copy the code
- 5XX: Server error
500 Internal Server Error Common Server errors.Copy the code
503 Service Unavailable The server cannot process the request temporarily (possibly due to overload or maintenance).Copy the code