New question with occasional updates (what happens to the http protocol when you type a url into the browser?)

HTTP protocol:

            Hypertext Transfer Protocol is the most widely used network protocol on the Internet. HTTPS is a secure http channel, which is the secure version of http.

            Why is there this agreement?

                      In order to establish a connection between the client and the server, let the two communicate

                      Self-understanding: let the computer speak according to the rules, you ask me to answer, how do you ask me how to answer, otherwise the computer will say different things and cannot communicate

            HTTP communicates through messages

                      Request message: request header, request line, request body

                      Response message: response header, response line, response body

             Request header: Accept: specifies the content type that the client can receive, Cache-Control: specifies the cache mechanism and cookie that the request and response follow; when an HTTP request is sent, all the cookie values ​​saved under the request domain name will be sent to the web together server.

                           Date: The date and time the request was sent, etc. (this is too much to remember)

      Request line: request method (commonly used post and get), request address (url), request protocol and version (HTTP/1.1)

             Request body: Just like passing data in a post form such as: name=aimee age=18 name=aimee&age=18 will appear in the request body

             Response line: response protocol and version number (HTTP/1.1), response status code (200) response status text (ok)

             Response header: Allow: valid action for a specific resource Connection expected options for this link ETag An identifier for a specific version of a resource, usually a message hash (to name a few)                                 

             Response body: the data we requested back   

status code:

           1xx received a request to continue processing

           2xx success

           3xx redirect

           4xx client error

           5xx server error

Common status codes:

               Success status code: 200 means success, 301/302 temporary/permanent redirection, 304 resource not modified  

               Failure status code: 404 The requested content does not exist, 500 The server is temporarily unavailable, 503 Internal server error

 The difference between the request method get and post:

                get uses url or cookie to pass parameters, while post puts the data in the body

                The url of get has a length limit, and post can transmit a lot of data

                post is safer than get                                      

 What happens when a url is entered in the browser: 

1. The browser resolves to the service IP through the DNS domain name             

DNS (Domain Name System (sometimes referred to as domain name)), a distributed database that maps domain names and IP addresses to each other, makes it easier for people to access the Internet without having to remember what can be accessed by A string of IP addresses directly read by the machine. Domain extension: .top , .xyz , .com , .cn , .edu . Features: Unique and non-repeatable

The IP address is the digital identification of the Internet host as a routing address, and it is not easy for people to remember. Therefore, a character type identification of the domain name is produced.

 In order to identify an entity, TCP/IP uses IP addresses to uniquely identify a host's connection to the Internet, and DNS helps us map domain names to IP addresses

2. The client establishes a TCP connection to the server through the TCP protocol

                     TCP protocol (transport layer protocol): Before sending and receiving data formally, a reliable connection must be established with the other party. A TCP connection takes three 'conversations' to establish.

                     UDP protocol: a non-connection-oriented protocol, that is, it is not necessary to establish a connection with the other party before formal communication, and it is sent directly regardless of the state of the other party. I think this is very similar to mobile phone text messages. When sending text messages, you only need to enter the other party’s mobile phone number. That's it

3. The client sends the http protocol package to the server to request the server's resource document

4. The server sends the http protocol response packet to the client

5. The client and server are disconnected, and the client starts to interpret and process the HTML document

 

Guess you like

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