DEV Community

FollowAndrew
FollowAndrew

Posted on • Updated on • Originally published at followandrew.dev

What is HTTP? How the Internet Works!

1st video on my comprehensive responsive web design series I'm releasing on YouTube! Learn about HTTP, Headers, and general "Internet Infrastructure" in this easy-to-digest beginner tutorial

Subscribe To The Channel!

How Do Networks Work?

Believe it or not, the vast majority of internet traffic is done through physically connected computers. In order to connect the continents together, large telecom companies lay underwater sea cables on the ocean floor! This is what enables the global world wide web to move so quickly, as these large cables are fiber-optics, and travel at the speed of light!

submarine cable map

  • image screenshot from submarinecablemap.com

HTTP

Hyper Text Transfer Protocol is made up of a simple request -> response cycle between a local machine (client) and a remote machine (server)

http cycle

The Request

When a request is made to a server, it has 3 important pieces of information that are sent from the client

  • Start Lines
    • Method
    • Target
    • Version
  • Headers
  • Body

http request

The Response

Being that HTTP is a stateless protocol (meaning no persistent connection is kept between the client and server machine) when a server receives a request, it simply answers with a response, which looks like this:

  • Start Lines
    • Version
    • Status Code
    • Text
  • Headers
  • Body

http response

HTTP Response Status Codes

The status code that is reported from the server is a 3 digit number, and tells the browser if everything was okay, or if something went wrong. Here are some common status codes:

  • 1xx Informational
  • 2xx Success
    • 200 (Success)
  • 3xx Redirection
  • 4xx Client Error
    • 404 (Page Not Found)
  • 5xx Server Error

HTTP Headers

Lots of information can be transmitted about the client and server computers in the 'headers' section of that cycle. Information such as timestamps, ip addresses, server capabilities, browser information, cookies, etc. can all be transmitted. Here is an actual look at a request and response header from a page request:

http headers

HTTP is based on TCP/IP, and has several versions (version 2 is common today). There is a lot more to learn about HTTP, specifically in relation to IP addresses, but we'll save that for a future tutorial.

Top comments (0)