HTTP Overview — What happens when you enter Google.com

Photo by Markus Spiske on Unsplash

What is HTTP?

  • HTTP stands for Hyper Text Transfer Protocol, used for transferring data over a network
  • HTTP is the foundation of data communication between web clients (often browsers) and servers (often computers in the cloud) for the World Wide Web.
  • Communication between client computers and web servers is done by sending HTTP Requests and receiving HTTP Responses
  • HTTP is stateless, every request is completed independently

What is HTTPS?

  • HTTPS stands for Hyper Text Transfer Protocol Secure, data sent is encrypted through SSL/TLS
  • Install SSL certificate on the web host, SSL (secure socket layer), TLS (Transport Layer Security)

HTTP Methods

  • GET: requests data from a specified resource
  • POST: send data to the server to create/update a resource — always contains HTTP request body to send to the data (more secure)
  • PUT: means “insert, replace if already exists”, similar to POST, but the same PUT request multiple times will always produce the same result
  • HEAD: is almost identical to GET but without the response body.
  • PATCH: is making partial changes to an existing resource.
  • DELETE: deletes the specified resource.

HTTP Response Status Codes

  • Informational responses (100–199)
  • Successful responses (200–299)
  • Redirection messages (300–399)
  • Client error responses (400–499)
  • Server error responses (500–599)

Requests & Responses

  • HTTP requests are generated by a user’s browser as the user interacts with web properties (clicks on a hyperlink, the browser will send a series of “HTTP GET” requests)
  • HTTP requests all go to either an origin server or a proxy caching server, and that server will generate an HTTP response.
  • HTTP responses are answers to HTTP requests.

HTTP Messages

  • Requests: method, path, version of the HTTP protocol, headers(content)
  • Responses: version of the HTTP protocol, status code, status message, headers(content)

headers

  • headers as key: value involving -> method, path, protocol
  • general: request URL, the request method, status code, remote address, referrer policy
  • request: host, language, cookies, accept-xxx, content-type, content-length, authorization, user-agent, referrer
  • response: date, server, set-cookie, content-type, content-length

content-type

  • content-type in the headers — what kind of data you are sending/receiving based on this request

application/x-www-form-urlencoded

  • the content-type describes form data that is sent in a single block in the HTTP message body (in the headers)

What Happens When You Enter Google.com on The Browser

Browser — Internet — Server — Internet — Browser

Once you enter Google.com, the browser extracts the domain name from the URL and sends a request via HTTP protocol (like an agreement based on TCP/IP) which connect to TCP/IP first before reaching to server.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hanwen Zhang

Hanwen Zhang

21 Followers

Full-Stack Software Engineer at a Healthcare Tech Company | Document My Coding Journey | Improve My Knowledge | Share Coding Concepts in a Simple Way