New issues with occasional updates (HTTP protocol What happens when you enter a URL in a browser?) )

Source: Internet
Author: User
Tags browser cache

HTTP protocol:
Hypertext Transfer Protocol is the most widely used network protocol in the Internet. HTTPS is a security-targeted HTTP channel, which is the security version of HTTP.
Why do we have this agreement?

         In order to establish a connection between the client and the server, let the two communicate (self-understanding: Let the computer according to the rules, you ask me, how do you ask me how to answer, or the computer will say the words can not communicate) HTTP is through the message communication: Request message: request header, request line, request              Body Response message: response header, response line, Response body request Header: Accept: Specifies what type of content the client can receive Cache-control: Specifies the caching mechanism that requests and responses follow When a cookie:http request is sent, all cookie values stored under the request domain name are sent to the Web server date: The day and time the request was sent If-none-match: matching ETA         G, if it modifies the cache if-modified-since: Send the last modified timestamp sent by the previous server back to the request line: Request method (common post and get), request address (URL), request protocol, and version (http/1.1) Request body: Like passing data with 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: The response body of the option that is expected for the link: That's the data we requested. Status code: 1XX received request relay Continue processing 2xx Success 3xx redirect 4xx client error 5xx Server error common status code: Success Status Code: 20 0 indicates success, 301/302 temporary/Permanent REDIRECT 304 resource not modified failed status code: 404 Request Content Not present, 500 server is temporarily unavailable, 503 server Internal Error request method get and post differ: Get uses URL or co  Okie, and post places the data in the body       Get URL has a limit on length, post can pass a lot of data post than get security  

The

HTTP cache:
HTTP caching mechanism is an important tool for Web performance optimization, and there are several rules for HTTP caching, categorized by the need to re-send requests to the server, divided into two broad categories: force cache, contrast cache. The
Force caching means that the browser will only use the browser cached files before the cache expires, does not send HTTP requests, compares the cache's meaning by requesting the server to determine if the browser cache is valid before deciding whether to use the browser cache.
Force caching how to tell if cached data expires:
When the browser requests data from the server without caching the data, the server returns the data and cache rules, the cache rule information is included in the response header, and for the force cache, there are two fields in the response header that are marked Ming expiration Rules: Expires or Cache-control, but expires is the HTTP1.0 of things now default browser is used by default HTTP1.1 so its function is basically ignored. HTTP1.1 version uses Cache-control

The 
  Cache-control is the most important rule, and common values are: private: Clients can cache public: both client and proxy servers can cache max                                                                                                                                            -AGE=XXX: Cached content will expire after xxx seconds No-cache: You need to use a contrast cache to validate cached data no-store: All content is not cached, forced cache, and contrast cache does not trigger                          There are two types of contrast caches: Etag/if-none-match and If-modified-since/last-modified ETag: When the server responds to a request, it tells the browser that the current resource is uniquely identified on the server last-modified: The last time the server was modified, and the ETag is used with If-none-match: When the server is requested again, this field passes through the        Unique identification of the server client cache data.                         Last-modified-since: When you request the server again, this field notifies the server of the last modification time of the resource that was returned by the server when it was last requested. The ETag and if-none-match work by adding etags information to the HTTP response. When the client requests the resource again, the If-none-match information (the value of the ETag) is added to the HTTP resquest, and if the server verifies that the etags of the resource has not changed (the resource has not changed), it will return a 304 state, or the server will return 200 status. and returns the resource and the new etags  

What happens when you enter a URL under the browser:
1. Browser through DNS domain name resolution to service IP
DNS: A distributed database that maps domain names and IP addresses to each other, making it easier for people to access the Internet without remembering the number of IP addresses that can be read directly by the machine.

    IP地址:是Internet主机的作为路由寻址用的数字体标识,人不容易记忆。因而产生了域名这一种字符型标识。

2. The client establishes a TCP connection to the server through the TCP protocol
TCP Protocol (Transport Layer Protocol): Before you formally send and receive data, you must establish a reliable connection with the other party. A TCP connection can be built up by three ' conversations '.
UDP protocol: Non-connected to the protocol, that is, before the formal communication with the other party first to establish a connection, regardless of the status of the other party directly sent, I think this is very similar to mobile phone messages, in the text, only need to enter the other's mobile phone number can be

3. The client sends an HTTP protocol package to the server, requesting the server's resource documentation
4. The server sends an HTTP protocol reply packet to the client
5. Client and server disconnected, client begins to interpret processing HTML document

New issues with occasional updates (HTTP protocol What happens when you enter a URL in a browser?) )

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.