views:

281

answers:

4

No, wait. I'm being totally serious. When HTTP was invented, FTP already existed. Why couldn't FTP be the web's transport protocol?

Sure, it has a lot of missing feautres, but most were added as an afterthought to HTTP and could be added to FTP too, such as caching, compression, virtual hosting.

You could event think of a protocol like CGI that allowed to automatically generate FTP files (pages).

+2  A: 

http is a protocol for downloading files with a displayable (by definition) format. FTP is optimized for exchange of files of all types and the download of directory information.

Could you have shoe-horned a display-oriented modification into FTP? Yes. Would it provide any benefit over a more custom-tailored protocol with a simpler interface? No.

Mark Brittingham
+4  A: 

There's no reason you couldn't. It would have been cumbersome, tacky and annoying though. I mean, you can make a boat out of a VW bug body. Doesn't mean it's a good idea.

Spencer Ruport
Hmmm... Off to find a VW Beatle and row it across the English channel.
Rich Bradshaw
Or conversly, you could use a up turned boat as a VW bug roof :P
Darknight
+22  A: 

Yes, you can serve HTML files using FTP. However FTP is a heavy-weight, stateful, protocol and assumes you will be staying on the same server. It is optimized for downloading larger files (where the setup overhead is amortized over the size and number of downloads) HTTP is very light-weight (you can communicate to an HTTP server using TELNET much easier than FTP, especially before PASSIVE FTP) and is designed around HTML -- the concept that in the course of your navigation you will be visiting many different servers and grabbing only a couple of files at a time from each.

Gopher existed before HTML and was very popular. It was also a light-weight protocol. It just didn't have the presentation and ease of entry that HTML had.

The short answer is, people invented all sorts of protocols for all sorts of reasons (i.e. doctoral theses) -- HTTP managed to come along at the right time and have the right set of features.

BTW, CGI wasn't even a part of HTTP at the beginning. It came along later -- and it was far easier to shoehorn CGI into HTTP than into FTP because of the simple, stateless protocol.

Oh, and there was no "web" before HTTP/HTML. The web needs HTTP because HTTP created the web.

Talljoe
FTP is also not as firewall friendly due to the nature of using a control channel and a data channel. HTTP only uses a single channel making it much easier to work with.
Matthew Whited
+1 - Nice answer - better than mine! However, I don't quite agree that it was "far easier" to shoehorn CGI into HTTP than FTP especially when you say that statelessness facilitated this adaptation.The stateful nature of the FTP protocol was probably key in designing a new protocol for the Web as it was *originally* envisioned (simple document downloads). However, the lack of statefulness has been a real PITA for web developers ever since; we have been forced to rely on state-management work-arounds that wouldn't have been needed under a stateful protocol.
Mark Brittingham
The first CGI applications took advantage of (or at least didn't care about) the stateless nature of HTTP. They just made things dynamic or processed the results of forms (For fun, go look here: ftp://ftp.ncsa.uiuc.edu/Web/httpd/Unix/ncsa_httpd/cgi/ ). Eventually people wanted to start doing stateful apps over HTTP and then the real shoehorning began. :)
Talljoe
+1  A: 

By the time the Web was coming together, FTP was already becoming cumbersome even for the simple exchange of files (i.e. what is was designed to do). It's a quirky and sometimes ambiguous protocol that doesn't play well with firewalls. People were already coding workarounds into FTP clients to try to sniff out what server software the FTP site was using to workaround its bugs.

In short, not the kind of thing you would base a new technology on.

Eli