DEV Community

Mohammed Ali
Mohammed Ali

Posted on

How web Works

  • REQ-RES model or CLI-SER architecture.
  • Structure of a HTTP Request: Protocol:Domain-name/Resource
  • HTTP Verbs: : GET - receiving data : POST - sending data : PATCH - updating data

HTTPS - encrypted using SSL/TLS.

  • HTTP request can be used to send data also, not just to get it.
  • Domain name is an easy-to-memorize wrapper over the numerical IP of the web-server.
  • DNS lookup: Convert domain to IP with port no which is used to identify the service running on the server.
  • TCP-IP Socket connection established: Kept alive until all data is transferred. Defines how data travels across the web.
  • HTTP Request is made: HTTP defines protocols of communication between Client-Server.
# Sample HTTP request: is sent

[[Start-line]] 
HTTP method-name    request-target[i.e resource]    HTTP/version[1/2]

[[Request Headers]]
HOST [domain-name]
UA [browser-name]
Accept-L/g [en-US]

[[Only when sending data using POST to server like in forms]]
<BODY>
Enter fullscreen mode Exit fullscreen mode
  1. Response is sent from the server for the request made.
# Sample HTTP response: is received
[[Start-line]]
HTTP version    Status-Code  Status-message

[[Response Headers]]
Date: Day, Date Mon Year
Content-Type: text/html
Transfer-Encoding: chunked

[[Response body, present in most responses]]
<BODY>
Enter fullscreen mode Exit fullscreen mode
  1. index.html is first to be loaded. When all files have arrived, then web-page is rendered by the browser. Process is repeated for each file as there is a requirement.

  2. TCP = breaks message into chunks before sending, assemble at destination such that packet takes its own route so as to reach quickly, won't be possible with a bigger file sent in one go.
    IP = ensures packet are delivered at the correct address.

Top comments (0)