Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0x11. What happens when you type google.com in your browser and press Enter #2444

Open
Mark-Tevin opened this issue Jul 25, 2024 · 1 comment

Comments

@Mark-Tevin
Copy link

What happens when you type google.com in your browser?

When one types google.com and presses enter, the browser takes several steps, which can be as follows:
. Resolves the IP address of the URL via DNS
. Generate an HTTP request with headers (user-agent, cookie, accept)
. Open an HTTP connection to the resolved IP address
. Send the request to the server
. Receive the response from the server
. Parse response headers
. Perform additional operations depending on the response header
. Decompress the response body if it's compressed
. Parse the HTML code inside the response body
. Resolves any additional resources (Scripts, Images, etc)
. Start loading those resources via their URLs using the same steps
. Render the HTML as soon as the required resources are loaded, and continue loading the remaining resources in the background.

@Elsmoil
Copy link

Elsmoil commented Aug 30, 2024

  1. DNS Resolution:

    • Your browser sends a request to resolve the domain name "google.com" into an IP address. This request is sent to a Domain Name System (DNS) server.
    • The DNS server responds with the IP address of the server hosting "google.com."
  2. TCP Connection:

    • Your browser establishes a Transmission Control Protocol (TCP) connection with the server at the IP address provided by the DNS.
    • This involves a three-way handshake process: the client (your browser) sends a SYN packet to the server, the server responds with a SYN-ACK packet, and finally, the client sends an ACK packet to establish the connection.
  3. HTTP/HTTPS Request:

    • Your browser sends an HTTP or HTTPS request to the server. If the request is HTTPS, a secure SSL/TLS handshake occurs to encrypt the communication.
    • This request typically asks for the default webpage (often "index.html") hosted at "google.com."
  4. Server Processing:

    • The server processes the request and prepares the response, usually in the form of an HTML document. It may also include other resources like CSS files, JavaScript, images, etc.
  5. Response Sent to Browser:

    • The server sends the HTML document and other requested resources back to your browser.
  6. Rendering the Webpage:

    • Your browser receives the HTML document and begins parsing it.
    • As it parses the HTML, the browser makes additional requests for any external resources (like images, stylesheets, and scripts) needed to fully render the page.
    • The browser renders the webpage, displaying the Google homepage on your screen.
  7. Interaction:

    • Once the page is rendered, you can interact with it, perform searches, or click on links, triggering new HTTP/HTTPS requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants