News for hackers. Stuff that matters.
Re:The 7-bit Internet by MichaelGG on Wednesday July 10, 2013 @08:44PM (#6023817)
I've written a couple parsers and stacks for SIP, a HTTP-derived protocol.

The text-based aspect isn't bad in and of itself. It's the crazy moronic rules and pointlessly flexible syntax that makes it bad. It's the fact that "text-based" is often taken to mean "should allow humans to be flexible in writing it", instead of "uses ASCII". Oh, and UTF8 if you're lucky. If you dare want a non-ASCII value that needs to go into a header, you're toast.

HTTP: Comments inside headers, line folding, context-sensitive header value parsing, and on and on. There is zero legitimate need for these things, yet RFC writers cannot seem to help themselves and design the most complicated syntax as possible.

Text-based formats frequently trick people into thinking they're right because it looks easy on the surface to get something to work. Shit, most HTTP clients/servers aren't actually fully compliant.

It opens more possibility for security holes due to potentially ambiguous parsing (where one implementation misses an edge case, but another doesn't). Protocols are not programming languages. They don't need flexible syntax.

There's also crap left over from a time when people read/write these protocols by hand. Idiocy like the IETF preferred date formats "Sun, 06 Nov 1994". Really? Including "Sun", the English 3-letter abbreviation, in a protocol? How is that useful?

HTTP is being used more and more for high-performance work. Take a look at a high-perf text-based parser, and you see all sorts of ugly hacks. Like doing bitwise comparisons on word-sized integers to determine the request method. (Both my personal code and nginx ended up with similar solutions, so it's safe to say it's a common approach for perf.)

Having a proper binary format that can be quickly, unambiguously, and safely parsed is a huge boon for interoperability and performance. The slight detriment for analyzing raw bytes (which, when encrypted makes it all moot) is not worth it. For a popular protocol like HTTP, you're gonna have plenty of tools to properly parse and analyze.

IP, UDP and TCP aren't text based, and I have no problems regularly analyzing them, nor do they seem to have adoption issues. But you can bet your ass if UDP specified port numbers as a flexible text field, you'd find all sorts of fun bugs and implementation issues.

Edit: After skimming the HTTP 2.0 spec, implementing this as a text-based protocol sounds like a nightmare with no benefit. It's not like you're going to write multiple streams out by hand or something (and use some terrible multipart-mime approach, or another "fun" ASCII-delimiting-binary thing).

Re:The 7-bit Internet by vidarh on Thursday July 11, 2013 @05:28AM (#6025161)
IMAP is the protocol I love to hate with a burning passion... I get that it is enormously flexible. But it is also a total, utter nightmare to work with, for not very good reasons.

Though I don't really agree with you that you need a binary format for interop and performance. You'd get the same benefits if people just constrained the text protocols. E.g. Your performance "hack" for HTTP request methods is only a hack because method names can be variable length. We could constrain method names to 4 bytes and make the whole thing cleaner while still getting the text protocol benefits of being able to manually inspect request/responses. Similarly, picking a sane date format like iso-8601 and restricting it further to a specific set of options would do wonders while still being readable/writable for humans.

I do agree with you that once a protocol gets as widespread as HTTP most of the benefit is lost as we get better tools to use anyway, though. Especially with debug tools built into most browsers these days.

The issue is not that non-text protocols are impossible to analyse, but that each new non-text protocol requires new tools to do so. For IP, UDP and TCP we've had decades to create good tools. If a common binary serialisation format was agreed and most protocols stuck to that, it would be much less of a big deal to ditch text-only protocols and rely on client side tools to allow reading or manipulating them as text.

Re:The 7-bit Internet by msds on Wednesday July 10, 2013 @09:11PM (#6023914)
> Protocols are not programming languages. They don't need flexible syntax.

Or, as the langsec crowd claims, protocols don't need flexible syntax, lest they actually become programming languages.

Re:The 7-bit Internet by archivator on Thursday July 11, 2013 @06:37AM (#6025312)
Relevant talk: Meredith Patterson on Turing-complete protocols and weird machines - https://www.youtube.com/watch?v=3kEfedtQVOY
Re:The 7-bit Internet by penguindev on Thursday July 11, 2013 @10:01AM (#6026028)
I disagree with your last line, if you know what http chunked encoding is, it is a 'simple ascii delimited binary thing' - it just doesn't have a 'stream id' in it, but there could be. Of course, people always forget to check the chunk length is <0 which makes for a constant stream of security holes over the years, but you would have the exact same problem in binary.

I think it's sad that HTTP/2.0 is primarily just trying to multiplex TCP and the rest seems like pure micro-optimizations (the one exception being server push; I haven't read a lot on that yet). It seems like the wrong layer in which to attack the problem, and is basically a huge 'meh'.

Re:The 7-bit Internet by DougWebb on Wednesday July 10, 2013 @10:53PM (#6024215)
What, exactly, prevents a binary protocol definition from being overly flexible and complex? I've seen quite a few like that, and I've seen quite a few simple and easy to parse text protocols.
Re:The 7-bit Internet by ajanuary on Thursday July 11, 2013 @06:48AM (#6025336)
Attitude. One of the big advantages that seems to be touted for text protocols is easy to use manually by humans, and with that can come a desire to make it forgiving of human error.

You can have simple text protocols and complex binary protocols, but it's more tempting to make text protocols more complex.

(In this comment, simple/complex is in terms of syntax only)