How the World Wide Web Was Born: Protocols, Hypertext, and the Browser
- 0 views
- Last updated
- Computer Science
The World Wide Web is not a network. The network was already there. This lecture follows one click all the way round the loop that was actually invented at CERN in nineteen eighty-nine: a URL that can name any document on any machine in one line of text, HTTP as the short fixed conversation that asks for it and answers, HTML as a format that ships a document's structure along with its words, and a rendering engine installed on every personal computer that turns that stream of characters into a laid out, clickable interface. Along the way it keeps the two layers apart: the Internet, which moves packets between addresses and has no idea what a document is, and the Web, which is three published agreements plus one program on your own desk.
In nineteen eighty-nine the cables were already there. Computers had been sending each other messages for twenty years. What was missing was not wire, and it was not speed. What was missing was an agreement about what to send. So start underneath the Web, with the thing it was built on top of. The Internet is machines, and links between machines, and very little else. Give one of them the address of another, and the network's whole job is to carry a bundle of bytes from this machine, through whatever sits in the middle, and on to that one at the far end. And it does not much care how. Cut one of those links and the same bytes arrive along the other path instead. Nothing in this picture knows what the bytes actually are. So there are two inventions here, and it is worth keeping them apart. The lower one moves packets between addresses, and by the late eighties it was already twenty years old. The Web is the upper one. It moves documents, and links between documents, and to exist at all it needed three new agreements and one new program. The picture I would keep in your head is this. The Internet is the road network. The Web is the postal system that runs on it: envelopes, addresses written the same way everywhere, and somebody at the door who can read a letter. So the Web needed four pieces, and I want all four named now, because everything after this is those four working together. The first is a way of naming a document, any document anywhere, in one line of text. The second is a protocol: a short fixed conversation for asking one machine for one of those documents, and getting it back. The third is a format for the document itself, so that a heading arrives labelled as a heading, and a link arrives labelled as a link. And the fourth is a program on your own machine that speaks the protocol, reads the format, and paints the result on your screen as something you can click. Four pieces, then, and one loop that ties them together: a name, a request, a reply, and a picture on the glass in front of you. Following that loop once, all the way round, is what the rest of this lecture does.
A document is no use to anybody if there is no way to say where it is. So the first invention is a way of writing that down, and here is one. This is the address of the first web page there ever was. Read it in three parts. The front of it says which protocol to speak. The middle says which machine to ask. And all the rest says which document you want from that machine. That is all a URL is. One string, answering three questions at once: which protocol, which machine, which document. Set the three pieces out side by side. The first is the scheme, and in this address the scheme is HTTP. It settles which protocol the two machines are going to speak. The second is the host. It is a name, and it names one particular machine, in this case a computer sitting in a laboratory in Switzerland. And the third is the path. Everything after the host is the server's own private business: which of its documents you are asking for. Notice what the string does not contain. It does not say how to find that machine, and it does not say how to ask. Naming is one job. Doing is another. So how does a name become a machine? It gets looked up. The browser hands the name to a separate service, older than the Web, whose whole job is turning names into numbers. A name goes in. An address comes out. And an address, unlike a name, is the thing the Internet actually understands. With that number in hand, the network does what we already watched it do. It finds a route to one particular machine, and now there is somewhere to send a question. And notice what we have not done. We have found a machine. We have not asked it for anything, and the path is still sitting in our hand, unused. That is the next piece.
We have found the machine. Now we have to ask it for something, and this is the piece that had to be invented from nothing. Not the wire. The words that go over it. The browser opens a connection to that machine and sends a request. A request is text, and it is almost embarrassingly short. One line saying what it wants: the word GET, then the path we were holding, then which version of the protocol it is speaking. And one line saying which host it thinks it is talking to, because a single machine can answer for many different names. The answer comes back the other way, and it has the same shape. A status line first: the protocol again, then a number, then a word. Two hundred means here it is. Then a line that says what kind of thing is coming. This one is text, in HTML. That single line is why the browser knows to draw the reply instead of saving it or playing it. And then, after a blank line, the document itself, poured down the wire as a stream of characters. That is HTTP. One question, one answer, and a note saying what the answer is made of. Three things about that exchange are worth pinning down. The first is that the client always speaks first. A server sits there and says nothing at all until it is asked. The second is that the reply describes itself. The same protocol carries a page, a picture or a sound file, and that one content type line is how the browser knows which it has been given. And the third is that once the answer is delivered, the exchange is finished. The server keeps nothing. Look: the whole conversation is gone, and nothing about you was left behind. So if you want a second document, you say the whole thing again from the beginning. A new request. The host line again. And the server treats you as a complete stranger. Same conversation, a different path, and a different document comes back down the wire. One question, one answer, written down once, and any two programs on Earth can have that conversation without ever having met.
The reply arrived as a stream of characters. Here is what those characters actually looked like, and this is the third invention: a format that carries the shape of a document along with its words. The first line says something quite specific. It says: the words The Project are a heading. Not big text, not bold text. A heading. These two say: this run of words is a paragraph. The brackets are the labels, and whatever sits between them is the content. And this last one is the line the whole Web turns on. It says: these words are a link, and the thing they point at is that address there. That is HTML. A document with labels on its parts, saying what each piece is and saying nothing at all about how it should look. Those labels nest inside each other, so what they really describe is a tree. The whole document is one element with everything else inside it. The heading, the paragraph and the link are three children of the body, side by side, in the order they were written. And the words themselves hang underneath, as the content of each one. Now look at what is hanging off the link instead. Not a file on this machine. A URL, exactly the sort of string we spent the last few minutes taking apart. And that is the join. The naming scheme goes inside the document, which means a document can point at any other document, on any machine anywhere that answers. So take that one step further. Here is a document at CERN, and here is another on a different machine altogether, in a different country. A link from the first to the second is nothing but a URL sitting in the first one's markup. No agreement between the two owners. No central register. No permission asked. And it works in every direction, from any document to any other, which is why what grew out of this is called a web and not a library. One format, with other people's addresses allowed to live inside it. That is what hypertext means, and it is the reason this thing spread the way it did.
So a stream of characters arrives on your own machine. Everything from here on happens locally, inside a program you installed once, and it happens in four stages. The first stage is parsing. Characters go in, and the tree we just drew comes out. That is the only stage in the whole engine that cares about angle brackets. The second stage is style. For every element in that tree the engine works out how it should look: how big, how heavy, what colour. The heading is set large and bold. The link goes blue and underlined. The third stage is the one that makes this a graphical interface rather than a printout. Layout. Given the width of your window, where does every one of those boxes actually go? The heading takes a band across the top. The paragraph takes as many lines as it needs at this width. The link takes a small box of its own. None of that was decided by the author: it was computed here, for your window. And the fourth stage is painting. Only now does anything appear on the glass: the boxes are filled in with actual letters, in the styles that were settled two stages ago. That is a rendering engine. Four stages, in a program on your own desk, and the same four stages for every document on the Web, whoever wrote it and whatever it says. Now the part that makes it feel alive. Those blue words are still an element in the tree, and the engine has not forgotten which box on the screen belongs to which element. So here is the whole loop, in five lines. It begins with a URL: either one you typed into the bar, or one that was sitting in a link you clicked. The name gets looked up, a request goes out over the Internet, and a reply comes back saying what it carries before it carries it. Your own machine parses it, styles it, lays it out, and paints it. Then you click something, which hands the engine another URL, and the loop starts again from the top. And now the thing that is easy to miss. No new program had to be written for that document. The browser was written once, and installed once, and it can display a page from a machine that was switched on this morning. That is why the protocol had to be published instead of sold, and why the format had to be dull, and textual, and boring. The agreement is the invention. The cables were already there. A name for anything. A conversation for fetching it. A format that carries its own structure. And a rendering engine on every desk. That is the World Wide Web.
Loading discussion…