Re: [hybi] Frame size

Scott Ferguson <ferg@caucho.com> Sat, 17 April 2010 03:27 UTC

Return-Path: <ferg@caucho.com>
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 77F483A6974 for <hybi@core3.amsl.com>; Fri, 16 Apr 2010 20:27:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.127
X-Spam-Level:
X-Spam-Status: No, score=-0.127 tagged_above=-999 required=5 tests=[AWL=0.278, BAYES_20=-0.74, IP_NOT_FRIENDLY=0.334, UNPARSEABLE_RELAY=0.001]
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 BySx-fLyA+an for <hybi@core3.amsl.com>; Fri, 16 Apr 2010 20:27:09 -0700 (PDT)
Received: from smtp114.biz.mail.sp1.yahoo.com (smtp114.biz.mail.sp1.yahoo.com [69.147.92.227]) by core3.amsl.com (Postfix) with SMTP id 6706F3A69DE for <hybi@ietf.org>; Fri, 16 Apr 2010 20:27:09 -0700 (PDT)
Received: (qmail 36867 invoked from network); 17 Apr 2010 03:26:59 -0000
Received: from scott-fergusons-macbook-pro-3.local (ferg@70.231.144.150 with plain) by smtp114.biz.mail.sp1.yahoo.com with SMTP; 16 Apr 2010 20:26:59 -0700 PDT
X-Yahoo-SMTP: L1_TBRiswBB5.MuzAo8Yf89wczFo0A2C
X-YMail-OSG: 05BXR9UVM1l_H91LW2ylOYic6aCfkkC9Vs_Ru61nQG9kySHz_ODzDMwPJpbBka_nvvfm8DaV_sr1qLlDTSlp5GRPsT5.fG5u7f_A88_bywr3L07V.51H1iC2YOAgef8uiZsFEt6UT3AFd7GVee7kn5KpuS_vN1YllaHOyyBhTb3WBbE5X0yRt8cb0OqiO8S.1NS_gARx.kWETyPg3FCxHoT07RDS0YLHYtlq0wvVVs1IcybGO.4umXbyuJ32Zr83EXdZDpsHx.ZB5c9O9K82RRSb9fL7aKVjfR0Tn9vLr.F6BRiNpdkDNg--
X-Yahoo-Newman-Property: ymail-3
Message-ID: <4BC92A7E.2080604@caucho.com>
Date: Fri, 16 Apr 2010 20:26:54 -0700
From: Scott Ferguson <ferg@caucho.com>
User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228)
MIME-Version: 1.0
To: Ian Hickson <ian@hixie.ch>
References: <8B0A9FCBB9832F43971E38010638454F03E3F313ED@SISPE7MB1.commscope.com> <Pine.LNX.4.64.1004161940180.751@ps20323.dreamhostps.com>
In-Reply-To: <Pine.LNX.4.64.1004161940180.751@ps20323.dreamhostps.com>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
Cc: Hybi <hybi@ietf.org>, "Thomson, Martin" <Martin.Thomson@andrew.com>
Subject: Re: [hybi] Frame size
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: Sat, 17 Apr 2010 03:27:10 -0000

Ian Hickson wrote:
> On Fri, 16 Apr 2010, Thomson, Martin wrote:
>   
>> Proposal:
>>
>>  - Frame size is indicated up front.
>>     
>
> This seems incompatible with the requirement that we not expose amateur 
> programmers to the complications of measuring UTF-8 strings.
>
>
>   
>>  - Frames are binary.
>>     
>
> Not sure what this means in this context, unless you mean the length is in 
> bytes and not in characters; if you mean the latter then I agree that any 
> length in the protocol should be in bytes.
>   
Unless the spec gets an editor who understands the basics of wire 
protocols, discussion is becoming pointless.

Or one capable of basic programming, really. "The complications of 
measuring UTF-8 length"? "chunking mechanics [are] non-trivial?"

-- Scott
>
>   
>>  - Frame size be strictly limited (2 octets should suffice).
>>  - Sub-protocol needed if messages are larger than the max frame.
>>     
>
> This seems like it would make the API highly unpredictable. For example, 
> it would mean that you could transmit 65,536 characters if they were the 
> character "X", but only 21,845 if they were the character U+263A. That 
> would be very confusing. Similarly, if we add compression, it would mean 
> that how many bytes you could pass in the send() method would depend on 
> how well it compressed. This would result in a very bad programming 
> experience, especially for anyone new to this kind of thing. (I would 
> expect most subprotocols to be ridiculously primitive; asking amateurs to 
> figure out chunking mechanics is non-trivial, especially if they have to 
> work out where to split a UTF-16 string as exposed in JS, before it is 
> converted to UTF-8 and compressed, which is what matters for deciding what 
> will fit in the frame.)
>
>
>   
>> Binary frames isolate user-space (the payload) from the framing layer.  We had this discussion in the meeting (c.f. Pete Resnick's comments).  Thus, 
>>  - binary frames are easier to process (intermediaries don't have to inspect every octet)
>>  - kinder on implementations (framing component does not depend on UTF-8 component)
>>  - isolates framing layer from the bugs of higher layers
>>     
>
> If we were designing a protocol for experts, I would completely agree. 
>
>
>   
>> IF used for UTF-8 AND implementer counts characters instead of octets 
>> THEN framing doesn't work. [...] One solution to this problem is to 
>> start a frame with a known sequence of octets, so that this can be 
>> detected.
>>     
>
> That's an interesting approach, but I worry that anything hardcoded like 
> this would be handled in ways that defeat the purpose. This is why, for 
> instance, the proposed handshake uses unpredictable keys to force the 
> server to prove it read the handshake -- otherwise, servers written by 
> amateurs might not actually read the handshake but just send back the 
> right response, simply assuming the handshake came from a Web Socket 
> server. If it weren't for targetting amateur programmers, the handshake 
> could be a heck of a lot shorter; we could even do away with the 
> requirement for a round trip and for the client to test the handshake, 
> since we could assume the server would only accept connections that were 
> trusted.
>
>