Re: [hybi] Max frame size

"Andy Green (林安廸)" <andy@warmcat.com> Thu, 23 June 2011 11:12 UTC

Return-Path: <andy@warmcat.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 36D9411E80E7 for <hybi@ietfa.amsl.com>; Thu, 23 Jun 2011 04:12:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.449
X-Spam-Level:
X-Spam-Status: No, score=-2.449 tagged_above=-999 required=5 tests=[AWL=-0.150, BAYES_00=-2.599, MIME_8BIT_HEADER=0.3]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XY5MMhsbKTbb for <hybi@ietfa.amsl.com>; Thu, 23 Jun 2011 04:12:38 -0700 (PDT)
Received: from warmcat.com (warmcat.com [87.106.134.80]) by ietfa.amsl.com (Postfix) with ESMTP id A388711E807F for <hybi@ietf.org>; Thu, 23 Jun 2011 04:12:38 -0700 (PDT)
Message-ID: <4E031FA4.10008@warmcat.com>
Date: Thu, 23 Jun 2011 12:12:36 +0100
From: "\"Andy Green (林安廸)\"" <andy@warmcat.com>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110531 Fedora/3.1.10-2.fc16 Thunderbird/3.1.10
MIME-Version: 1.0
To: Francis Brosnan Blázquez <francis@aspl.es>
References: <1308720860.5393.18.camel@tot.local> <20110622060514.GF18843@1wt.eu> <1308738811.11941.704.camel@vulcan.aspl.local> <20110622122521.GA22198@1wt.eu> <1308756913.11941.823.camel@vulcan.aspl.local> <4E021121.5050409@caucho.com> <1308826861.11268.47.camel@tot.local>
In-Reply-To: <1308826861.11268.47.camel@tot.local>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Cc: hybi@ietf.org
Subject: Re: [hybi] Max frame size
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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: Thu, 23 Jun 2011 11:12:39 -0000

On 06/23/2011 12:01 PM, Somebody in the thread at some point said:

> While I see this API makes the buffering (max frame size) problem for
> the websocket developer to be not an issue, is in fact not solving but
> moving the problem to the app level where, again, the application will
> have to buffer the content until a message is completed.
>
> I still think we need a way to each party to notify its buffering or
> message size limit capabilities, *mainly*, because we have a framing
> designed to notify messages, defined as *units* by the draft, not
> bytes...

The way I think of it is that frames are directly analogous to TCP/IP 
packets, one level up.

Everyone accepts application code has to act defensively and not make 
assumptions about tcp / ip packet lengths and if they got merged or 
fragmented along the way.  How much turns up at any given time when 
poll() or select() tells you something came must be treated like a 
random number you find out when you read from the socket and it says how 
much was ready.  You can't be expecting 32 bytes every time because you 
think that the sender always sends 32 byte packets.

It's the same with frames, reliance on assumptions about when they turn 
up, in how many pieces of what size needs to be defended against in the 
code so it's not vulnerable to problems.  If you take that approach it 
naturally leads you away from this idea you need to buffer whole frames.

-Andy