[hybi] Summary of open issues regarding Framing Proposal Take VII

John Tamplin <jat@google.com> Thu, 19 August 2010 23:28 UTC

Return-Path: <jat@google.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 1C2763A6A24 for <hybi@core3.amsl.com>; Thu, 19 Aug 2010 16:28:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -104.934
X-Spam-Level:
X-Spam-Status: No, score=-104.934 tagged_above=-999 required=5 tests=[AWL=1.042, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
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 WTi-pvTagk9u for <hybi@core3.amsl.com>; Thu, 19 Aug 2010 16:28:47 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.35]) by core3.amsl.com (Postfix) with ESMTP id 116AF3A6A0B for <hybi@ietf.org>; Thu, 19 Aug 2010 16:28:46 -0700 (PDT)
Received: from wpaz37.hot.corp.google.com (wpaz37.hot.corp.google.com [172.24.198.101]) by smtp-out.google.com with ESMTP id o7JNTKvX016342 for <hybi@ietf.org>; Thu, 19 Aug 2010 16:29:21 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1282260561; bh=aj0pTsv+QxBJCCCJ7AjQIt8t7Y0=; h=MIME-Version:From:Date:Message-ID:Subject:To:Content-Type; b=fX53uLt6eFDztq9jpsdPWJaW5e6E16JN0EVzwdZV0DRY26bLmrEzVB+sDlB4bCsT3 rBr7iRWzc2iYd7FmQQNNA==
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:from:date:message-id:subject:to:content-type:x-system-of-record; b=VDUBOAhL1INSZfnWzgAQUO/TjlHkAKuxdANkROwg2ppyyOKxhxbyFq6VemDOV3bnz TV33QO2lmhXiyzr0oW/gA==
Received: from yxn35 (yxn35.prod.google.com [10.190.4.99]) by wpaz37.hot.corp.google.com with ESMTP id o7JNTJwR008963 for <hybi@ietf.org>; Thu, 19 Aug 2010 16:29:19 -0700
Received: by yxn35 with SMTP id 35so1128429yxn.18 for <hybi@ietf.org>; Thu, 19 Aug 2010 16:29:19 -0700 (PDT)
Received: by 10.150.58.8 with SMTP id g8mr1043224yba.102.1282260559426; Thu, 19 Aug 2010 16:29:19 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.151.60.3 with HTTP; Thu, 19 Aug 2010 16:28:59 -0700 (PDT)
From: John Tamplin <jat@google.com>
Date: Thu, 19 Aug 2010 19:28:59 -0400
Message-ID: <AANLkTinisjWZccUPwNN1xFEPPwSkB11uzMRo22G48EpO@mail.gmail.com>
To: "hybi@ietf.org" <hybi@ietf.org>
Content-Type: multipart/alternative; boundary="000e0cd34850277465048e358d3d"
X-System-Of-Record: true
Subject: [hybi] Summary of open issues regarding Framing Proposal Take VII
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: Thu, 19 Aug 2010 23:28:49 -0000

I am trying to summarize here what seem to be issues up for further
discussion -- forgive me if I leave something out:

   1. the use of a 2-level length field vs a fixed 64-bit length or a
   variable-length-length field (as in v76)
   2. the use of continuation opcode
   3. putting close/ping/pong in the control frame payload rather than as
   separate opcodes
   4. the presence of the complete message length field in the base protocol

If there are any others, feel free to reply to this thread.

#1 - length field
=================
For #1, I think a fixed 64-bit length is unacceptable because of the penalty
it imposes on small messages.  As discussed previously, existing WebSocket
apps make heavy use of small frames, compression will make more frames
smaller, and I suspect many future WebSocket apps will make heavy use of
small frames.  Finally, existing mobile networks pay a penalty for larger
frames, so we should strive to make as many as possible fit in small frames.

Regarding the variable-length length, I prefer the current proposal for the
following reasons:

   - it saves a bit in the header, which gives us more options for future
   expansion
   - it has two steps of length rather than 9, and looking at the overhead
   at various packet lengths there is little justification for more than 3
   - reading one byte at a time imposes an (admittedly small) penalty on the
   performance of the reader
   - the variable-length length has additional complications which need to
   be defined away, namely leading 0x80 bytes and the maximum length of the
   field.  I would suspect that many naive implementations use a 32-bit field
   for the length and would fail to notice overflow when shifting the current
   length.  Being able to convince some implementations that the frame length
   is different than others would be a key way to exploit vulnerabilities.

That said, I would not block consensus over this issue -- if others feel the
variable-length length is better I could live with it -- we would just move
RSV2 into the length field, and define that additional length bytes follow
if the high bit is set (while outlawing leading 0x80 bytes and limiting the
number of bytes in the length to 9, giving the same 63 bits of length as the
current proposal).


#2 - the use of the continuation opcode
=======================================
What I was trying to avoid here was defining how changing opcodes across
fragments should be defined.  What do you do when the first frame has a
different opcode than later frames?  Should the last one win even if the
receiver has already started decoding it based on the first opcode?  Should
the receiver check it and drop the message if the opcode changes?

I would not object to leaving this out and simply defining it as a protocol
error to use a different opcode in a continuation frame, though I worry that
might open up more opportunities for bugs where an implementation doesn't
verify that and opens an attack vector (admittedly, if an implementation
doesn't verify the continuation opcode there may still be attacks, but if it
is specifically expected I suspect that would make implementations more
robust - they might ignore the opcodes of subsequent packets which would be
mostly ok).


#3 - putting close/ping/pong/etc in a control frame rather than giving them
their own opcode
============================================================================================
These frames will be infrequent and we have limited opcode space (especially
if we primarily use opcodes for extensions).  I would strongly prefer
defining a control opcode and moving all out-of-band operations into the
control-frame payload.

Here too, I would not block consensus over this issue, so if most people
prefer them as opcodes I could go with that, though we would likely need to
allocate one of our precious reserved bits to the opcode field to do so, as
otherwise we would be leaving little room for growth.  Note that while we
could later add an extended opcode that lets you allocate additional
opcodes, that would be no different than using the control frame as
proposed, other than we would have reserved first-class opcodes for less
frequent frames while delegating presumably more frequent opcodes to
second-class status.


#4 - the presence of the complete message length field in the base protocol
===========================================================================
If we are supporting fragmentation in the base protocol, it seems that an
intermediary that fragments the message should be able to provide the
receiver the original message length, without requiring that recipient
support extensions.

Again, I would not object strongly to removing this (leaving CMLP as a
reserved bit) as long as that didn't bring back the objections about
fragmentation it was intended to address.


So, while I prefer the proposed solution in each of the above cases, I am
not entrenched against other options.  Can we get a feel from the group on
the following questions:

   - are there other divisive issues which need to be addressed before we
   can declare the framing for the base protocol done?
   - does anyone feel strongly enough about the above issues that they want
   to make a case for why an alternative should be chosen?  Or are there a lot
   of people who would be happier if a different choice was made?

If the answer to both of the above are no, can we accept this as the base
protocol?

-- 
John A. Tamplin
Software Engineer (GWT), Google