News for hackers. Stuff that matters.
Re:HTTP 2.0 by voidlogic on Tuesday July 09, 2013 @10:17AM (#6012754)
>I would have liked to see an ascii based protocol

I disagree I think HTTP should have been a simple binary protocol from the start and HTML should have required compilation into a binary format.

How much work would have it really been? htmlcmp foo.html providing foo.bhtml. No whitespace, No end tags, one or two byte tags, etc. Strictness in the reference HTML compiler implementation could have saved the web from all the stuff outside the actual standard that browsers (and other tooling) now have to support (so they don't "break" the web).

I'm not suggesting anything as crazy as the flash binary format (I wrote a Java flash player once...), but when I started to write things like proxy servers and HTML minifers I was blown away by the extreme inefficiency of HTTP/HTML.

This is a step in the "right" direction IMHO.

Re:HTTP 2.0 by samwillis on Tuesday July 09, 2013 @10:24AM (#6012796)
I believe that the "world wide web" took off for two reasons. It was completely free and it was incredibly easy for ANYONE to make a website. If you needed to "compile" all HTML it would have discouraged a lot of casual experimentation. Not everyone understands what a compiler is.

Just as an example I started playing around with HTML when I was about 12 (in 1998), it was easy and I got instant results. A year or so later I tried to learn Perl and quickly gave up because I couldn't get my first script to run. It was another year before I tried to "program" again and became hooked.

HTML and HTTP were successful because they were incredibly easy to understand. I wish we could keep it that way.

Re:HTTP 2.0 by wtbob on Tuesday July 09, 2013 @01:19PM (#6013833)
Wouldn't it have been cool if there were an efficient binary format and a nice human-readable and human-editable format, with a well-defined transformation from one to the other?

Back in the 1990s, Ron Rivest came up with canonical S-expressions, which are fully capable of representing the same information represented by HTML, XML, ASN.1—but can be either human-readable or binary.

Here's a simple example: (p (* class (footer x-treme)) "This is a " (b "footer") "."). Very human-readable, very human-editable, and easily machine-readable, wouldn't you agree?

As a binary format, it would be (1:p(1:*5:class(6:footer7:x-treme))10:This is a (1:b6:footer)1:.). Still geek-manipulable, if necessary, and extraordinarily simple to parse. And it has the advantage that it is a distinguished encoding--any of the myriad human-readable encodings all reduce to the same canonical encoding, which has advantages for hashing.

Re:HTTP 2.0 by ajanuary on Tuesday July 09, 2013 @10:52AM (#6012943)
I'd argue the big thing that made HTML so easy to play with was permissiveness, not the lack of explicit compilation.

Perl doesn't tend to have an explicit compilation step. You could write a HTML compiler to be as permissive as HTML parsers and you wouldn't have the same frustration you had trying to get started with perl.

Re:HTTP 2.0 by peterwwillis on Tuesday July 09, 2013 @12:01PM (#6013308)
Gopher was simpler to understand than HTTP/HTML. But it wasn't as flexible, and didn't have as nice support for pretty pictures and midi files.

If anything, HTTP/REST was much more complex. HTML was somewhat mystic yet allowed you to move things around easier, and actually design things vs just presenting them. And hyperlinks were really cool.

http://www.ils.unc.edu/callee/gopherpaper.htm

Re:HTTP 2.0 by voidlogic on Tuesday July 09, 2013 @10:29AM (#6012827)
>HTML and HTTP were successful because they were incredibly easy to understand. I wish we could keep it that way.

The web is big enough today that we can afford to make it more efficient since we have so many professionals that don't require the kind of implicit hand-holding provided by the original implementations. Back then everyone was a newbie and there were no web professionals.

Re:HTTP 2.0 by samwillis on Tuesday July 09, 2013 @10:41AM (#6012889)
I think we need to be careful about claiming its more efficient. There seemed to be significant disagreement about how much more efficient SPDY was last year from the various different benchmarks. From memory the consensus seemed to be that its only 5-10% quicker. Does anyone have any more up to day benchmarks?

I hate the idea that you would have to be a "web profesional" in order to get started today. We should embrace and keep the culture the web was built on.

Re:HTTP 2.0 by MrDOS on Tuesday July 09, 2013 @10:45AM (#6012904)
That's an incredibly good way to lock out new newbies. I don't know how many people I know who got into programming through web development. Just because existing web developers don't necessarily need a simple solution doesn't mean new web developers couldn't take advantage of it.
Re:HTTP 2.0 by arh68 on Wednesday July 10, 2013 @06:38AM (#6018529)
For what it's worth, I started messing with HTML in elementary school, but had no idea how simple HTTP/1.0 was until I hit the 400 level classes in college. Editing in Notepad was the only way to go back then: even Dreamweaver got too complicated. Likewise, my first foray into JMS/message-queue type stuff was with STOMP, the simple text-oriented message protocol: there was no way I was going to understand the 'open wire protocol' for ActiveMQ. Ain't got time for that!

All that said, I think peterwwillis is right: http/X.0, as long as it's well-simplified, is better in binary than it is in text. Ideally, there's a bijection between your text-mode and binary-mode (like a lens), where it's easy to parse (rely on your toolset to do the translation back and forth) and easy to put on the wire. Forth is a good example of how to do it sanely.

Re:HTTP 2.0 by voidlogic on Tuesday July 09, 2013 @11:31AM (#6013162)
Really? I can't imagine anything they might do putting this out of the reach of say a sophomore C-S student or a motivated independent learner.
Re:HTTP 2.0 by nitrogen on Tuesday July 09, 2013 @02:00PM (#6014083)
A lot of current professionals started out as 11- and 12-year-olds dodging COPPA to host their first HTML web sites, not CS sophomores.
Re:HTTP 2.0 by voidlogic on Tuesday July 09, 2013 @05:01PM (#6015466)
>A lot of current professionals started out as 11- and 12-year-olds dodging COPPA to host their first HTML web sites, not CS sophomores.

I would put those 11 and 12 year old down under "motivated independent learner"

If your concern is the a binary HTTP, too bad, it already here, its called HTTPS. It does seem to be holding anyone back.

If your concern is a binary HTML/compiler for it, I don't by that either. I was using a compiler when I was 8 years old and didn't have a problem with it conceptually.

Re:HTTP 2.0 by jimktrains2 on Tuesday July 09, 2013 @09:00PM (#6016763)
HTTPS is HTTP over a TLS connection, not a binary version of HTTP.
Re:HTTP 2.0 by voidlogic on Wednesday July 10, 2013 @09:16AM (#6019242)
Obviously, but hits take very helpful to look at HTTPS over something like wireshark. That was my point.
Re:HTTP 2.0 by steveklabnik on Tuesday July 09, 2013 @12:32PM (#6013508)
Yesterday, I showed a classroom full of high school kids HTML and CSS. They were so excited to be building stuff, and thought it was so neat that the text would turn into a web page.

Just because we have more 'professionals' today doesn't mean everyone is a professional.

Re:HTTP 2.0 by drawkbox on Tuesday July 09, 2013 @03:56PM (#6014969)
I think to get maximum innovation on anything technology related, it should always be simple enough to get started at any level, then as you gain more experience you can (and the specs allow you to now -- AS2/EDIHTTP spec for one has encryption, compression, on top of HTTP/HTTPS - http://www.ietf.org/rfc/rfc4130) do more for performance, optimization etc otherwise it is premature optimization and a bit of a wall.

Like with gaming, each game should be simple to start but deeper to master. That is what this layer is all about, lower down the OSI stack it is much more of a wall to beginners. Never lock out beginners as they can be better masters with time, don't hide the entrance to the labyrinth. Leave things as approachable, but with better professional experience, modifiable to perform better. We have all that now, a competing binary protocol will never see the innovation that a more simple one like HTTP will. Higher up the stack you can see how this was better for exchanging data in standard ways from old school binary blobs, to CSV files, to XML files, to JSON. Same reason REST services won over SOAP, simplify... There is a JSON binary format BSON in mongo and also MessagePack but guess which one is used more in service/exchanging data the textual one or the binary ones? The binary formats work well in certain situations where both endpoints are controlled by the same entity.

Binary and more locked down/optimized formats and messaging have their place but the start/base should always focus on simplicity over optimization.

The general rule in exchanging via standards is be liberal in what you accept, conservative in what you send. Being all binary all the time is a backwards step and is conservative on what is accepted, I also think it would lead to a host of difficult to debug problems just based on work I did with AS2/HTTP RFC implementation one of them being streaming and of course encoding/decoding which can fill hours of work if you can't visually see the content at some level.

Re:HTTP 2.0 by cenhyperion on Tuesday July 09, 2013 @02:07PM (#6014143)
But I don't think we should be raising the barrier to entry and making it more difficult for a young hacker to get started. Like the above commenter I started hacking around with HTML and CSS when I was around 12 and it led me into linux/python/php/web frameworks.

There's something beautiful about being able to teach someone how to write a basic HTML document in 20 minutes. My mother can easily understand what HTML is doing, I doubt she'd understand a compiler.

Re:HTTP 2.0 by ANTSANTS on Tuesday July 09, 2013 @03:13PM (#6014642)
I see where you're coming from, I had a similar experience playing with HTML as a kid. That said, "compiling" HTML from text to an efficient binary format wouldn't have prevented browsers from including those compilers themselves and transparently compiling all plain text pages received. Newbies could keep on serving plain text HTML (until someone chastises them for it) while the web as a whole would benefit from the increased efficiency that comes from binary pages being the norm.

Your argument doesn't really apply at all to HTTP, though. No one "got their start" peeking at HTTP requests. It's solely the domain of those working on infrastructure (for some definition of that word). Anyone with any idea of what HTTP really is (ie more than "that thing at the start of a URL") should have no problem using a tool to convert between a binary and text representation of the protocol. It's not like you can just magically pull HTTP requests out of the ether, you need a tool anyway. There's no reason why curl (for example) couldn't transform a request you write into an equivalent binary protocol, or why it couldn't do the inverse operation when it receives the response. It's utterly ridiculous to me that there is such inefficiency in HTTP just to make things slightly easier on the implementers of curl and wireshark.

Re:HTTP 2.0 by weavejester on Tuesday July 09, 2013 @12:45PM (#6013594)
HTTP is a protocol designed to communicate information between two machines. There's no reason it should be human-readable. Trying to make a protocol that's easy for humans to read and write leads invariably means making it harder to write software for.
Re:HTTP 2.0 by dspeyer on Tuesday July 09, 2013 @01:46PM (#6013986)
A while back, I wrote a daemon that checked a bunch of network stuff in a loop. I needed a UI for it, so I made it speak http. No library, just raw GET support. It worked. Didn't take long to write, either. I would never have tried that with a binary protocol.
Re:HTTP 2.0 by nitrogen on Tuesday July 09, 2013 @02:02PM (#6014100)
I don't think anyone's saying HTTP/1.1 should go away.
Re:HTTP 2.0 by weavejester on Tuesday July 09, 2013 @03:53PM (#6014948)
You say that like you think a custom binary protocol would be harder than writing a HTTP server, even a simple one, from scratch.
Re:HTTP 2.0 by dspeyer on Tuesday July 09, 2013 @05:58PM (#6015867)
A custom binary protocol? Then I would have to write a client! And install it everywhere. And keep it updated. And design my gui in wingdi instead of html.

That is not a viable option.

Re:HTTP 2.0 by weavejester on Tuesday July 09, 2013 @06:27PM (#6016093)
I thought you said you weren't using existing libraries? Or did you just mean for the server? You made it sound as if you thought writing a server for a custom binary protocol was harder than writing a HTTP server from scratch.

If you're aiming for an existing ecosystem, then sure, there's no reason not to use HTTP, assuming you make use of established libraries. But widespread use is HTTP's only real virtue; the protocol is considerably more difficult to implement correctly than it should be.

Re:HTTP 2.0 by dspeyer on Wednesday July 10, 2013 @01:09AM (#6017556)
No libraries. Ordinary web browsers for the client side.

A minimal HTTP server that recognizes GET requests, finds the url, throws away everything else, runs the relevant code and returns an HTML document of the results is actually really easy to write. And easy to integrate into an existing event loop.

Re:HTTP 2.0 by weavejester on Wednesday July 10, 2013 @05:52AM (#6018394)
Sure, if you cut corners, place some hard buffer limits, discard the vast majority of the specification, and don't care about breaking parts for brevity, HTTP starts to become tractable.

But even a minimal HTTP server, even one that ignores things like HEAD requests, is still going to be more complex than, say, receiving the URL raw, or even a URL wrapped in a simple structure like a netstring.

Actually implementing a full, correct HTTP server would be one or two orders of magnitude more complex that implementing a more modern protocol from scratch.

Re:HTTP 2.0 by dangoor on Tuesday July 09, 2013 @10:28AM (#6012823)
Despite the "extreme inefficiency", HTTP/HTML have managed to work successfully for a very long period of time (and even worked decently well on very slow hardware in the '90s).

There is actually a binary format that much of the web content is compiled into: gzip. It's remarkably effective.

I will grant that following Postel's Law means that browsers have more work to do to ensure that all kinds of "busted" stuff on the web continues to work, but I'd guess that, at this stage, that work is pretty small compared to everything else browsers are trying to do.

Re:HTTP 2.0 by voidlogic on Tuesday July 09, 2013 @10:35AM (#6012858)
>here is actually a binary format that much of the web content is compiled into: gzip. It's remarkably effective.

I'm sure you realize this but gzip is a content encoding. If there was a binary html format, it could still (and should be) gzipped (or better yet 7-zipped).

I did some playing around this this and gzipped binary encoded HTML ended up around 1/4th the size a gzipped minified HTML.

Gzip doesn't give you the other advantages of the hypothetical binary format, primarily: An extremely standardized and quickly parseable format.

Re:HTTP 2.0 by samwillis on Tuesday July 09, 2013 @11:36AM (#6013182)
what "binary encoded html" did you use? I would be interested in seeing this as my initial thought would be that the both would gzip to almost exactly the same size?
Re:HTTP 2.0 by voidlogic on Tuesday July 09, 2013 @01:00PM (#6013715)
>what "binary encoded html" did you use?

This was for internal testing, so it was a custom implementation.

>my initial thought would be that the both would gzip to almost exactly the same size?

That is like saying you would expect a gzipped CSV file to be as small as a gzipped database engine file. This of course not the case.

Re:HTTP 2.0 by jessaustin on Tuesday July 09, 2013 @02:47PM (#6014457)
So which is which? Is html the csv or the DB dump? What is this metaphor even supposed to mean? It's not as though a csv file is sufficient to serialize a database.

Actually, it would be more informative to point us at a "binary encoding", any binary encoding, that compresses smaller than the equivalent html text.

Re:HTTP 2.0 by bitwize on Tuesday July 09, 2013 @04:37PM (#6015280)
I would expect the gzipped CSV file to be smaller.

When you add in indexes or B-trees or whatever else database engines use to retrieve data quickly, database files can get quite big indeed.

Re:HTTP 2.0 by specialist on Tuesday July 09, 2013 @10:36AM (#6012867)
HTTP should have been a simple binary protocol from the start

What are the advantages of binary HTML vs plaintext HTML + gzip?

I've observed many binary format efforts. Various binary XML, BSON, binary VRML.

The only efforts that made any sense (penciled out) were binary geometry representations eg enabling mesh compression.

(PS- I hate tagged formats like XML and HTML with the passion of a billion burning suns.)

Re:HTTP 2.0 by jakejake on Tuesday July 09, 2013 @11:00AM (#6012992)
Compiled binary HTML seems to me would be the end to the open nature of the web. The fact that anybody can view the HTML source is probably irrelevant from a network point of view. But I consider it a fundamental aspect of the web.
Re:HTTP 2.0 by voidlogic on Tuesday July 09, 2013 @11:15AM (#6013075)
How would:

  hacker@gibson:~$ htmcmp ./myPage.html
  myPage.bhtml generated successfully. 
  hacker@gibson:~$ htmdmp ./myPage.bhtml
  myPage.html dumped successfully.
Hinder an open web? Maybe I am wrong, but my gut tells be this argument comes from developers who are not used to working with compiled languages.

I think it would help new devs, can you imagine how nice it would be to have a handy HTML validator like this compiler would be? And how good for the web it would be to force everyone to use it? I can't imagine learning C without the feed back of a compiler and that was what I hated most about learning javascript and HTML.

If you really hate the idea of having to run this compiler, it could be automatically run by apache, IIS, nginx, etc when serving your page for the first time. This is all hypothetical of course since such a standard does not exist.

Re:HTTP 2.0 by steamer25 on Tuesday July 09, 2013 @12:51PM (#6013653)
I think what jakejake is getting at is that right now, anyone can pull up a page in their browser, click 'View Source' and see exactly how to express that page in a human-readable format. This is also true to a large extent (via various free development tools--some even baked into various browsers) for JavaScript and CSS.

What's interesting is that what you describe: >this compiler, it could be automatically run by apache, IIS, nginx, etc ...essentially already occurs in many cases in the form of compression such as gzip. These files are also automatically extracted by the browser and are essentially as transparent as non-compressed ones.

So I think you both have a point: I agree with jakejake that the web must remain transparent. I agree with you that as long as sufficient tooling is freely available, it doesn't matter how the underlying protocol works. I.e., a binary representation of the page is still fairly transparent if there are plentiful tools that will deserialize it into a page object that can be expanded/perused/manipulated and then re-serialized when e.g., Ctrl+s is hit.

What would be bad is if 'View Source' showed something like: 01010100011010000110100101110011001000000110100101110011001000 00011011110111000001100001011100010111010101100101 etc. ...and you needed to spend umpteen hundreds to get a decompilation tool that only gave you an obfuscated/inexact reproduction of the recipe for the page.

Re:HTTP 2.0 by lstamour on Tuesday July 09, 2013 @01:13PM (#6013802)
Given IE, Safari, Firebug and Chrome all support ADDITIONAL developer tools, how likely do you think it is that you'll be stuck with raw binary when the browser has to decode this to the same internal representation used for HTML today?

Nothing will change on the front-end, just the servers will get faster and new bugs will be introduced. :)

Re:HTTP 2.0 by nitrogen on Tuesday July 09, 2013 @01:32PM (#6013919)
Meta: Is it too late for you to edit your post to break up your string of digits or put it in a code block (prefix with two spaces, surrounded by blank lines)? It's forcing the whole comment page to have a horizontal scrollbar.
Re:HTTP 2.0 by hollerith on Tuesday July 09, 2013 @01:47PM (#6013992)
Yes: it's annoying enough for me to decide not to bother with the comments on this story.
Re:HTTP 2.0 by steamer25 on Tuesday July 09, 2013 @04:07PM (#6015047)
Sorry, I'm willing but appear to be unable at this point.
Re:HTTP 2.0 by njharman on Tuesday July 09, 2013 @12:47PM (#6013609)
Because the web took off cause non-developers, prot-developers were able to easily create pages, look at html/css/js and become developers. It seems trivial to you but having a compile step complicates things to beyond the reach of many.

Plain text is more open and accessible than binary, full stop.

Re:HTTP 2.0 by btilly on Tuesday July 09, 2013 @01:30PM (#6013899)
I remember. There were an awful lot of people who learned from, "How did that work? Let's view source!"

Once pages become big and complex, this learning strategy becomes much harder. But in the early days of the web it was utterly essential.

Re:HTTP 2.0 by LinaLauneBaer on Tuesday July 09, 2013 @01:05PM (#6013753)
You could have embedded the compiler right in the browser. If you would open a html page it could have been automatically compiled and vice versa.
Re:HTTP 2.0 by lstamour on Tuesday July 09, 2013 @01:14PM (#6013812)
You will still need and use plain text. File:// isn't powered by HTTP ;-)
Re:HTTP 2.0 by jakejake on Wednesday July 10, 2013 @12:04AM (#6017389)
Not that it really matters, but since I'm the one who brought it up and your gut was telling you that I'm not likely familiar with compiled languages - I started programming in Pascal and Assembly in the 80's, moved onto Java and C# and lately I spend a lot of my time writing Objective C code.

It'll be no skin off my nose if the web turns into a compiled protocol. I don't know if it's even necessary to continue with plain text web sites these days. But, it most certainly was a major deal initially for me to just "view source" and see that it wasn't a black box of voodoo. The low barrier to entry is one of the major reasons the web took off.

I'll admit I'm an old timer in this business, probably ready to be taken out back and shot! So I have no idea if you youngsters were similarly inspired by viewing the source code on a web site? Maybe with all of the complex client side code and minimized scripts that it isn't even relevant anymore? It probably just looks like gobbledygook to a non-programmer these days.

Re:HTTP 2.0 by nickik on Tuesday July 09, 2013 @05:41PM (#6015746)
> from developers who are not used to working with compiled languages.

I am used to working with compiled languages, 9 million lines of C++ on a embeded costum hardware.

Now I know of course that it would not be that bad but still, I dont want to compile more stuff, I want to compile less stuff. I'll let the VM do the compilling for me.

In the grand sheme of thing these discussions hardly matter, its just a 'cool' topic to fight about. Neither with HTML or HTTP size is a big issue, almost never the bottleneck.

Re:HTTP 2.0 by rjsw on Tuesday July 09, 2013 @11:42AM (#6013208)
The "standard" way to have done this at the time would have been to use ASN.1, either on top of an OSI stack or used in a similar way to SNMP.
Re:HTTP 2.0 by schrodinger on Tuesday July 09, 2013 @11:40AM (#6013201)
Doesnt GZipping HTML fix most of what you're complaining about?
Re:HTTP 2.0 by voidlogic on Wednesday July 10, 2013 @09:21AM (#6019261)
No. There is more discussion in this thread, but for starters:

1. Gzipping doesn't make the HTML syntax that must be parsed by browsers more regular and efficient to parse.

2. Gzipped minified HTML is 4x as large as gzipped binary encoded HTML when I tested it.