HTTP Learning Notes

Source: Internet
Author: User


11th Chapter
Client identification and cookie mechanism

Cookies---Powerful and efficient persistent identity recognition technology

Referer header provides the URL of the user source, cannot represent the user, but can explain the user visited that page before---better understanding of user browsing behavior (dot??? )

Cookies are the best way to identify a user for a persistent session today

The difference between session cookie and persistent cookie-----is the expiration time

A cookie typically refers to a unique identification code that contains a server for tracking purposes

Let the browser accumulate a set of server-specific information, each time you access the server to provide this information to it

Interview title: What happened from the input URL to the page load?
First answer:
1.DNS parsing
2.TCP Connection
3.HTTP Connection
4. The server processes the request and returns the HTTP request message
5. Browser parsing Render page
6. End of connection
Second answer:
No proxy, simple HTTP request IPV4

1. Browser query cache, if cache exists jump to 9

2. The browser asks the IP address of the operating system server

3. The operating system does DNS query, return the IP address to the browser

4. The browser opens a TCP connection to the server

5. The browser sends HTTP requests over a TCP connection

6. The browser receives the HTTP response and may turn off the TCP connection, or re-use the connection to process the new request.

7. The browser checks whether the HTTP response is a redirect (3xx result status code), a validation request (401), error (4xx 5xx), and so on, which are normal processing (2XX) for different responses.

8. If the response is cacheable, it will be cached.

9. The browser decodes the response (for example, if it is gzziped compressed).

10. The browser decides how to handle these responses (for example, it is an HTML page, a picture, a piece of music).

11. The browser displays the response, and the download dialog box pops up for the unknown type.

Each step in the side can be lengthy and, of course, there are a lot of things that happen in parallel with these steps.


301 and 302
301 Permanent Transfer
302 Temporary transfer


In detail, both the 301 and 302 status codes represent redirects, which means that the browser automatically jumps to a new URL address after it gets the status code returned by the server.
, this address can be obtained from the location header of the response (the effect that the user sees is that the address a that he entered becomes another address B)-that's what they have in common.
The difference between them is. 301 indicates that the resource for the old address A has been permanently removed (this resource is inaccessible).
The search engine crawls new content and also exchanges the old URL to redirect the URL; 302 indicates that the resource for the old address A is still (still accessible).
This redirect only temporarily jumps from the old address A to address B, the search engine crawls new content and saves the old URL


TCP three-time Handshake protocol
Includes one synchronization message, one synchronization-response message, one Response message

Why three times?
The purpose of the "three-time handshake" is "to prevent a failed connection request message segment from suddenly being transmitted to the server, resulting in an error"



TCP four times Wave

Client wants to break up.
The server wants to break up too
Server is ready to break up.
Break
After the server accepts this acknowledgement package, it closes the connection and enters the closed state.
After the client waits for 2MSL, no reply is received to ensure that the server is actually closed and the client closes the connection and enters the closed state.

HTTP Learning Notes

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.