Re: [hybi] WS ABNF

Dave Cridland <dave@cridland.net> Tue, 16 February 2010 08:47 UTC

Return-Path: <dave@cridland.net>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id E889428C0DC for <hybi@core3.amsl.com>; Tue, 16 Feb 2010 00:47:57 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id waO7lANJhlgA for <hybi@core3.amsl.com>; Tue, 16 Feb 2010 00:47:56 -0800 (PST)
Received: from peirce.dave.cridland.net (peirce.dave.cridland.net [217.155.137.61]) by core3.amsl.com (Postfix) with ESMTP id 742153A7C42 for <hybi@ietf.org>; Tue, 16 Feb 2010 00:47:56 -0800 (PST)
Received: from localhost (localhost.localdomain [127.0.0.1]) by peirce.dave.cridland.net (Postfix) with ESMTP id 3111111680B8 for <hybi@ietf.org>; Tue, 16 Feb 2010 08:49:26 +0000 (GMT)
X-Virus-Scanned: Debian amavisd-new at peirce.dave.cridland.net
Received: from peirce.dave.cridland.net ([127.0.0.1]) by localhost (peirce.dave.cridland.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oQysXstlnIxy for <hybi@ietf.org>; Tue, 16 Feb 2010 08:49:25 +0000 (GMT)
Received: from puncture (puncture.local [IPv6:2001:838:378:0:221:85ff:fe3f:1696]) by peirce.dave.cridland.net (Postfix) with ESMTPA id D309711680B3 for <hybi@ietf.org>; Tue, 16 Feb 2010 08:49:25 +0000 (GMT)
References: <8B0A9FCBB9832F43971E38010638454F032E566DDF@SISPE7MB1.commscope.com>
In-Reply-To: <8B0A9FCBB9832F43971E38010638454F032E566DDF@SISPE7MB1.commscope.com>
MIME-Version: 1.0
Message-Id: <18559.1266310165.853559@puncture>
Date: Tue, 16 Feb 2010 08:49:25 +0000
From: Dave Cridland <dave@cridland.net>
To: Server-Initiated HTTP <hybi@ietf.org>
Content-Type: text/plain; delsp="yes"; charset="us-ascii"; format="flowed"
Subject: Re: [hybi] WS ABNF
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 16 Feb 2010 08:47:58 -0000

On Mon Feb 15 01:12:53 2010, Thomson, Martin wrote:
>      frame         = text-frame / binary-frame
>      binary-frame  = %x80 length *%x00-FF
>      length        = %x00 / %x01-7f / ( %x81-FF *%x80-FF %x00-7F )
> 
> This is a canonical length encoding in that it doesn't allow for  
> leading zeroes.

Am I alone in seeing two design errors here?

Firstly, I see no benefit in having two different framing types. I do  
see a marginal benefit in having multiple frame types, but the idea  
of distinct framing just strikes me as a bad idea, and prone to  
error. I think the correct design decision here is that "bytes is  
bytes", and to the wire, all frames are binary and octet counted. I'm  
not against an end marker, incidentally, although I'm not convinced  
it's needed except in early stages of implementation.

Secondly, is that really a bespoke new method for integer  
representation on the wire? What is the overriding benefit over a  
network byte order 32-bit integer? I see that it can be 1-N octets,  
and therefore will typically save 1-3 octets - I'm assuming we're not  
expecting to ship more than 256M in a frame, where the trade off is.

But the chances of this making a measurable difference are very slim,  
whereas the perils of decoding a new integer representation seem  
extraordinarily high, especially given that it's a nicely unbounded  
integer. IMAP implementations used to have enough trouble when asked  
to allocate 4G for a literal, after all, but at least I'm unaware of  
them having decoding difficulty. OTOH, with 5 octets, I can now setup  
a frame length of 32G, and I can't see anything suggesting that this  
is even a bad idea, let alone illegal protocol.

I have other comments - I'm bewildered that a server responding with  
"HTTP/1.1 101 Web Socket Protocol Handshake." will fail to interop  
with compliant clients, for instance - but I'm intending to leave  
these for a later mail - just be warned these are coming.

Dave.
-- 
Dave Cridland - mailto:dave@cridland.net - xmpp:dwd@dave.cridland.net
  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
  - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade