Sobes.tech
Middle+

What happens when you make an HTTP request from a browser before receiving a response?

sobes.tech AI

Answer from AI

When a browser makes an HTTP request, several steps occur:

  1. DNS resolution — the browser converts the domain name into an IP address.
  2. Establishing a TCP connection — the browser sets up a TCP connection with the server (usually on port 80 or 443 for HTTPS).
  3. TLS handshake (if HTTPS) — a secure connection is established.
  4. Sending the HTTP request — the browser constructs and sends the request (method, headers, body).
  5. Waiting for a response — the browser waits for a response from the server.

During this time, the browser can:

  • Render the content already received.
  • Perform other requests in parallel (if the browser policy allows).
  • Handle user events.

After receiving the response, the browser begins processing:

  • Parsing headers and body.
  • If it's HTML, starting to build the DOM.
  • Loading additional resources (CSS, JS, images).

Thus, between sending the request and receiving the response, network interaction, waiting, and data processing preparation occur.