Wednesday, August 16, 2017

What happens when you press Google.com in your browser?

1. Parse The line gets parsed and the protocol, server, port, query gets retrieved 2. Resolve to IP Address Browser connects to server at the default/specified port 2.1. If it is in local DNS cache, fetch it 2.2. Else, recursively check IPS's DNS servers 3. Send Request Browser sends a GET request followed a crlf sequence then by the headers all followed by respective crlf-s 3.1 If this server has already cached cookies, the browser sends them as cookie headers 3.2 If the browser supports compression it tells the server what compression is using (via headers) as well as what compression it could accept in return 3.3 Sends a content-length header set to value "0" 3.4. Sends a header instructing the server how to denote the end of its transmission stream. Connection: Close would be the most common 3.5 Sends a crlf sequence to mark the end of the headers (after eventual other headers are sent) 4. Handle Response 4.1. Parses the response code / status 4.2. If this response starts with 2 it caches cookies, decompresses (if header is mentioning compression) parses and displays the html content of message body (executing eventual scripts hooked to different DOM elements/events) 4.3 If the response code starts with 3 redirects t the server mentioned in the response (goto 11) 4.4 If the response code starts with 4 or 5 parses the response and displays it to the user

No comments:

Post a Comment