Re: [hybi] WS ABNF

Jamie Lokier <jamie@shareable.org> Wed, 17 February 2010 02:52 UTC

Return-Path: <jamie@shareable.org>
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 8146528C144 for <hybi@core3.amsl.com>; Tue, 16 Feb 2010 18:52:06 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.613
X-Spam-Level:
X-Spam-Status: No, score=-2.613 tagged_above=-999 required=5 tests=[AWL=-0.014, 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 rUgbE3EW+5sZ for <hybi@core3.amsl.com>; Tue, 16 Feb 2010 18:52:05 -0800 (PST)
Received: from mail2.shareable.org (mail2.shareable.org [80.68.89.115]) by core3.amsl.com (Postfix) with ESMTP id 90B8B28C143 for <hybi@ietf.org>; Tue, 16 Feb 2010 18:52:05 -0800 (PST)
Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from <jamie@shareable.org>) id 1Nha2k-0000bj-86; Wed, 17 Feb 2010 02:53:38 +0000
Date: Wed, 17 Feb 2010 02:53:38 +0000
From: Jamie Lokier <jamie@shareable.org>
To: Dave Cridland <dave@cridland.net>
Message-ID: <20100217025338.GA1654@shareable.org>
References: <8B0A9FCBB9832F43971E38010638454F032E566DDF@SISPE7MB1.commscope.com> <18559.1266310165.853559@puncture> <4B7A5FD1.8090005@gmx.de> <18559.1266313683.441640@puncture>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <18559.1266313683.441640@puncture>
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: Server-Initiated HTTP <hybi@ietf.org>
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: Wed, 17 Feb 2010 02:52:06 -0000

Dave Cridland wrote:
> >It's not really new; something similar (or even the same thing?) is  
> >used in HTTP chunked encoding.
> 
> Chunked uses a (straightforward, if excitingly unique) ASCII hex  
> representation of the size of the following chunk, and chunked  
> terminates with an empty chunk (and the trailer).

One crucial difference with chunked is, if you think the recipient
will break with a chunk >=2GB (say), you can arbitrarily limit the
maximum chunk size by introducing splits.

But of you actually have an 8GB WebSocket message, a 32-bit length
would introduce an arbitrary limit guaranteed to break.

I know that's not intended normal WebSocket usage.

But imagine someone writes a trivial WebSocket services which recieves
the name of a file (say, it's just an example), and sends back the
contents of the file as a message.  Imagine it was written intended
for small files, but someone decided to use it for bigger ones one day
because it was convenient to do so, and it turned out to work fine.

Then one day, someone else puts an 8GB file there and expects it to
work.  Why should it be fine for 3GB files but fail for an 8GB file?

> It's passingly similar to UTF-8 codepoints, I suppose, and something  
> about it nags me into thinking of BER, and the self-termination is  
> vaguely reminiscent of the encoding used for codepoints in punycode,  
> albeit not nearly as clever.

Maybe for generality (no fixed limit), but it might have been an
attempt to use fewer bytes for small messages.  Considering most
messages are expected to be small(*), that's not entirely illogical.

(*) - The WebSocket JavaScript API philosophy pretty much requires this,
although other clients aren't bound in the same way.

-- Jamie