Everyday Magic is a diary series that seeks to explain many of the computing concepts we use on a regular basis in a way that non-techies can understand, and introduce them to the lingo we techies use in the process so that people know what tech types are talking about as well as how technology changes in the news will affect you! For more information about The Technomancer or the Everyday Magic series, please take a moment to read the founding installment of the series.
Hello, Kossacks!
If you're reading this, you probably got here via a web browser, like Internet Explorer, Chrome, Safari, or Firefox. The web browser is truly an awesome tool -- it was the first piece of technology that really opened up a use for the Internet for the masses. It provided a graphical interface to content hosted on the Internet, and it was easy to reach other sites on the network by following links to their content, rather than waiting for bulletin board systems (commonly referred to as a BBS) services like FidoNet to forward the latest messages and email to your local node.
But what actually happens when you click your DailyKos bookmark, or the link from Google, or type dailykos.com into your address bar? Follow me below the cloud and I'll teach you!
That's not a server. THIS...is a server!
Many people can tell you that web pages are hosted on servers. But if you're not familiar with technical jargon, you might not know that server has two primary definitions in common use when it comes to computing.
The first definition is the one many people think of when they hear the word server -- the computers that are neatly racked up with all sorts of wires coming out of them, like you see in the pictures they show in articles talking about Google's data center, or Facebook's data center.
The second definition, however, isn't often referred to outside of technology circles. A server is also a piece of software that runs on one of those server-grade computers that serves (hence the name) a content or service to someone or something else, whether that's a web page to you, dear reader, an automation service to another computer, or any other piece of content or a service.
So while you may be aware that your computer talks to a server to get the website delivered to you, you may not be aware, that much like a bad Internet meme, that there's a server in that server that serves, possible even to other servers!
Well, that's cool and all. But what does that have to do with commenting and laughing at the GOP?
If you've been following Everyday Magic, you know how your computer finds www.dailykos.com once you type in in your browser. This happens by DNS, which was explained in Everyday Magic's inaugural installment.
But that wouldn't do us any good if there's no server configured to deliver the content, and if it wasn't on the right port that our browser is looking for. A port, in computer networking terms, is a more specific point to connect to on a server than just the IP address. See, you can have multiple software servers running on a single hardware server. In order to allow software to distinguish which server program it should be connecting to, either the user or the software itself will direct its request at a specific port on the computer to get content or use a service from only one of those software servers.
Hang on a minute. I don't see any port numbers in http://www.dailykos.com/. What's the deal?
Sure you do! See, http://www.dailykos.com/ is a bit of text known by one of two names: a uniform resource locator (URL), or uniform resource identifier (URI). The http (which stands for HyperText Transfer Protocol, as we discussed in the first Everyday Magic) portion of the URL is your port identifier -- without any other modifiers, that tells your browser to go to the computer located at www.dailykos.com and get the content being served on port 80 that's located at the website's index, which in the case of Daily Kos, we refer to as a front page.
If you're banking, using Facebook, or doing other tasks where you want the webpage to be secure, you've probably noticed that the front portion of the URL changes to https. This indicates you're using the Secure HyperText Transfer Protocol, which defaults to port 443 rather than 80.
You can also explicitly specify a non-standard port number (one other than 80 for HTTP or 443 for HTTPS) by adding a colon at the end of the URL followed by the port number. So let's say that I was working on Daily Kos, and I needed to test some changes or my deployment process. This process is known as staging a change, and usually happens in a staging environment, which are servers configured as close to identical as production servers (sometimes shortened to prod) like the ones serving Daily Kos now. However, I wanted to run them at the same time as the current site, and use the same URL to ensure the new code processed everything properly. In such a case, I can configure a virtual host in my web server on an alternate port, like 8080 instead of 80, and access it by using the url http://www.dailykos.com:8080/.
I'm confused. How come http/https are port identifiers on their own and I don't need to put :80 after www.dailykos.com all the time?
In order to set standards for communication over different protocols and ports, an organization called the Internet Assigned Numbers Authority (IANA) manages the assignment of standard ports for different service and communication protocols, like port 25 for outgoing email, port 80 for unencrypted web sites, port 22 for secure shells (SSH), 21 for file transfer protocol (FTP) connections, and a whole list of other common and uncommon services.
This group also has the authority over the DNS root zone and the allocation of IP address space to the various regional Internet registries (RIRs) like RIPE or ARIN.
It's a great example of how the 'Net works by working with each other to settle on sets of standards to ensure functionality between the various networks that are internetworked together to make The Internet.
Gotcha. So how does my browser get the content once it connects to the web server at http://www.dailykos.com?
Great question. This is your lucky day! We here at Everyday Magic manage to land an exclusive interview with a web browser and a web server, and we're proud to present it to you now!
Everyday Magic: Thanks for taking the time to sit down with us today. Where's the web server?
Web Server: (from behind a door) 503 Service Unavailable!
Web Browser: Dumping core.* Should be back soon.
* It's true, we here at Everyday Magic are not above using bathroom humor, and geeky bathroom humor at that.
WS: (flushing noises, enters the room and sits) 200 OK. Sorry about that. I'm all right now.
200 OK and 503 Service Unavailable is one of the HTTP status codes that indicate if a request to a web server was handled properly, if there was an error, or notifies a browser that the content is elsewhere, along with other functions. 200 OK means everything went as expected with no error. Every web server starts a response with the HTTP status code as part of the header, one of the pieces of metadata involved in a connection.
EM: Great. Let's get started then. How do you guys work together to deliver sites like Daily Kos to us in meatspace?
WB: Well, when a human tells me to go to a web site, I take a look to see if anything's where they told me to go, and if so, I reach out to the port I'm told to and greet what's listening there.
WS: 200 OK. We actually do the computer equivalent of greeting each other. Humans refer to this process as the transfer control protocol (TCP) handshake.
WB: Yep. Once we've introduced ourselves, I'll ask the server here for the content I was asked to get. If just an address was specify, I'll ask for the site index.
WS: 307 Temporary Redirect. Browser never asks how my family is doing.
WB: Uh, let's stay on topic here, please... Anyway, that content comes as HTML markup code. In the case of static content, this code is either typed out by humans, or generated with a script once before being made available. If it's dynamic content, the web server will talk to a database to fill in the blanks of a static page template. That's what Daily Kos here does.
WS: 200 OK. That's correct.
EM: Fascinating.
WB: Once I get that content in code form from the web server here, I interpret it and display a page to you based on what the code tells me to put where.
EM: What if the web server can't talk to the database to get dynamic content?
WS: 200 OK. Sometimes the database stops listening to me, or is just too busy to answer me. In those cases, I'll try to respond with the static content alone, but usually it gives a--
* Browser smacks server upside the head *
WS: 503 Service Unavailable!
WB: Server'll recover from that once he can connect to the database again.
EM: I...see. And what happens if I ask for content the web server doesn't have?
WB: This. Hey server, give me arugklnzingfka.html, please.
WS: 404 Not Found. What the hell is wrong with you, man? That hurt!
WB: But we had to show these nice people....
WS: 200 OK. That's not okay.
WB: But you just said...
WS: 200 OK. I'm not talking to you any more.
WB: But...
WS: 204 No Content.
WB: Don't be that way.
WS: 204 No Content.
EM: I've got what I need. Thanks, you two.
WB: No problem. Thanks for having us. Let's go, server.
WS: 418 I'm a teapot.
Yes, that's actually an HTTP status code, based on a joke request for comment (RFC), which is one of the rules that define any internet service, offered as an April Fool's joke.
WS: Didn't mean to hit you that hard...
And that, fellow Kossacks, is how Daily Kos gets delivered to your browser. Please take the poll so we here at Everyday Magic know what topics you're interested in us covering! If what you want to see isn't in the poll, please request it in the comments!
Thanks for reading Everyday Magic!