top of page

What is HTTP?

Introduction


Moving across the long chain of internet protocols, from IP to TCP, we've uncovered how data is sent from one machine to another...


But now what? How is that data interpreted?


To answer that question, we'll need to understand the Hypertext Transfer Protocol (HTTP).


The Role of HTTP in Data Transmission


HTTP is what is called an application layer protocol, a protocol that defines a language that clients (who request web pages from a server), and servers (who return information to the client) must communicate with.

  • clients are like devices that users interact with (PC, laptop, phone, etc.)

  • servers can be hardware or software and provides services to clients


Suppose we wanted to access Google's homepage (via google.com).


An example of a client-side request is:

GET / HTTP/1.1
Host: google.com
... (info about client) ...

An example of server-side response:

HTTP/1.1 200 OK
Content-type: text/html
... (HTML code of homepage) ...

What would happen if google.com didn't exist?

HTTP/1.1 404 Not Found
Content-type: text/html
... (HTML code of 'Not Found' page) ...

Note that HTTP/1.1 specifies that the version of the protocol is 1.1. Each version is almost like its own language.


Like humans have to speak in a single language to understand one another, so do clients and servers.



Also, you may have noticed that the numbers displayed actually changed depending on the success of the server-side. These numbers are called status codes:

Status Code / Text

Meaning

200 OK

Valid request and response (success)

301 Moved Permanently

Page is at a new location (auto-redirect)

302 Found

Page is temporarily at a new location

401 Unauthorized

Requires login credentials to access

403 Forbidden

Server does not allow request no matter what

404 Not found

Server cannot find the page requested

500 Internal Server Error

Server failed in responding to the request (something went wrong in server)

Final Thoughts


Hopefully the Internet and its protocols are at least slightly more digestible now. Thanks for reading!

Σχόλια


bottom of page