
One could argue that the heart and sole of web development work is the HTTP Messaging System. When you visit an enjoyable website, such as the one you’re on now, you either go to a link, a bookmark, or type in jollygreenegiant.com
to the URL bar to see what I’ve written lately. But what happens after that?
Behind the scenes, in the browser, an HTTP request message is made to the server. The server accepts the request and then sends back an HTTP response message and the browser interprets the message and renders the contents as HTML, JavaScript, CSS, media, and other goodies. Of course, this is oversimplified to the extreme, but it gets the point across.
An HTTP request message, at it’s bare minimum looks like this, in plain text, shooting across the internet at breakneck speed.
POST /example-path HTTP/1.1
Host: jollygreenegiant.com
Let’s break this down, shall we? The first part of the first line simply says POST
. This is call the “HTTP Verb.” I’ll shortly be posting a whole new article about HTTP verbs, as they indicate much about what the request is meant to do.
The /example-path
bit tells the server where this request is supposed to go. HTTP/1.1
is simply the protocol version for HTTP.
The host name is where the server that will handle this request is going.
The server processes the results, and then sends back a response message. Let’s take a gander at that, too, shall we?
HTTP/1.1 200 OK
Content-Type: text/html
<html>
<head>
<title>An Example Page</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>
Again, we see our old (a protocol from 1997 IS ancient, in the technology world) friend, HTTP/1.1
, with a 200 OK
next to it. The 200 OK
just means that the request was completed successfully. I’ll make another post with information about status codes.
Content-type: text/html
simply tells the browser how to parse the request body, which follows below.
Web development rests on these messages. The speed at which data can move depends on the infrastructure between the two interconnected computers (e.g. your computer, and the server this site is served by). We know that these messages can, in theory be moved between networks very close to the speed of light, but generally speaking, is moving at about 1/2 the speed of light through glass fibers.
Now, when the glass fibers reach your home or work network (of course, you’d be looking at my blog during work hours for work purposes, right?) they are slowed down substantially by the copper wires in the internal infrastructure of your network. Data moves far slower through copper than through glass silica.
It’s a lot quicker than carrier pigeons, though. Now if only I could get Amazon packages to travel that fast!