HTTP Notes

Basic browser connection handling

  1. The browser parses the server hostname from the URL
  2. The browser converts the server hostname to the corresponding IP address
  3. The browser parses the port number from the URL
  4. The browser establishes a TCP (Transmission Control Protocol) connection to the web server
  5. The browser sends an HTTP request message to the server
  6. The server sends back an HTTP response message to the browser
  7. Close the connection, the browser looks like the document

HTTP network protocol stack

TCP

Transmission Control Protocol, which specifies how data is sent from one place to another.

TCP mainly provides

      1. Error-free data transmission
      2. In-order transmission (data will always arrive in the order in which it was sent)
      3. Unsegmented data stream (data can be sent out at any time and at any size)

As long as the TCP connection is established, the data exchange between the client and the server will not be lost or out of sequence.


structural components of the web

Proxy: An intermediate entity between the client and the server. Receives all HTTP requests from the client, forwards them to the server (possibly modifying the request).

The request or response can be filtered (virus detection of downloaded programs, blocking of some pornographic content, etc.).

cache

Gateway: Usually used to convert HTTP data to other other protocols.

three-way handshake

In order to deliver the data accurately, the TCP protocol adopts the three-way handshake strategy.


HTTP status codes

The HTTP status code is responsible for indicating the return result of the client's HTTP request, marking whether the server-side processing is normal, notifying errors, etc.

  category reason phrase
1xx Informational Status Code    The received request is being processed    
2xx success status code The request is processed normally
3xx redirect status code Additional action is required to complete the request
4xx Client error status code The server was unable to process the request
5xx server error status code Error processing request by server
  • 200, OK, the request has been processed normally
  • 204, The request was processed but no resources to return
  • 301, the requested resource has been assigned a new URI
  • 302, temporary redirection (the requested resource is temporarily assigned a new URI)
  • 401, the request sent is not authenticated (requires HTTP authentication)
  • 403, access to the resource is not allowed
  • 404, No resource requested
  • 500, an error occurred on the server side
  • 503, The server is overloaded or is down for maintenance and cannot process the request now





















Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324867101&siteId=291194637