[hybi] method of allocation of reserved bits to extensions

Brodie Thiesfield <brodie@jellycan.com> Thu, 28 April 2011 01:12 UTC

Return-Path: <brofield@gmail.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 664CEE08F6 for <hybi@ietfa.amsl.com>; Wed, 27 Apr 2011 18:12:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.477
X-Spam-Level:
X-Spam-Status: No, score=-2.477 tagged_above=-999 required=5 tests=[AWL=0.500, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_LOW=-1]
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 UUqHuWpDN8HG for <hybi@ietfa.amsl.com>; Wed, 27 Apr 2011 18:12:11 -0700 (PDT)
Received: from mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by ietfa.amsl.com (Postfix) with ESMTP id B6EF8E0800 for <hybi@ietf.org>; Wed, 27 Apr 2011 18:12:11 -0700 (PDT)
Received: by pzk5 with SMTP id 5so1666417pzk.31 for <hybi@ietf.org>; Wed, 27 Apr 2011 18:12:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type; bh=RoR7gr+AiZyV8qePpTII5WsfE1OUSZf2N+irF6r/T1Q=; b=Y5ajW6lS6U31ooFXmgLj+MRdkusmqqyB7qxjPmAiWQxo3sc0Cd2m78Nv2EKnVefqDN b4Yo/cKvELf+mgu+bcyvRxHuACGnOsW7p83L+O2V+zOW4xKIjd5M+q1CMw0qLfFUbdjt phBSGoL2EVhmbLjdyJtiMYASh+nb9YhVC5mnQ=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=vsgGcKfmrRdnSxuyWdDUTMreS3ybbFIDREGqi/7y8Te7C4T6MPkWHoJR0VLaqDHsmn Uj7Iyn9BHNgJOGCqPHO+0g/dpJkk7QpYJJeYzlWBRbflb6tcSYG1HJ8mWdVGg934KVwl 73bFaD95d9ZtnoPLI6rdbF6TfaTSJlGws4Z1o=
MIME-Version: 1.0
Received: by 10.68.6.168 with SMTP id c8mr3102826pba.40.1303953131270; Wed, 27 Apr 2011 18:12:11 -0700 (PDT)
Sender: brofield@gmail.com
Received: by 10.68.54.35 with HTTP; Wed, 27 Apr 2011 18:12:11 -0700 (PDT)
Date: Thu, 28 Apr 2011 10:12:11 +0900
X-Google-Sender-Auth: HW3prKsOMN_Bcu5cCxP8cxjAKpM
Message-ID: <BANLkTi=vOQDtL5GobitKe8yiUoQFb2go_Q@mail.gmail.com>
From: Brodie Thiesfield <brodie@jellycan.com>
To: Hybi <hybi@ietf.org>
Content-Type: text/plain; charset="ISO-8859-1"
Subject: [hybi] method of allocation of reserved bits to extensions
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, 28 Apr 2011 01:12:12 -0000

All,

The WebSocket spec permits extensions to use reserved bits, however I
can't see that it provides any way to negotiate which bit should be
used in the presence of multiple extensions competing for a reserved
bit. If a negotiation method is not prescribed, each extension will
just state "using RSV1" or similar in their spec and then either that
bit will become the "extension X bit" or that extension will not be
compatible with other extensions that want to use the same bit.

For example, a "deflate-payload" extension that allows optional
compression might want to use a bit in the frame to denote
compression. If it is used with the "mux-a-million" extension that
also wants to use a reserved bit, both server and client need to agree
on which bits are used. The server needs to allocate these reserved
bits to the extensions that require them.

I propose the following addition to the extensions section:


8.2 Negotiating Reserved Bits

An extension may require or desire the use of a reserved bit in the
framing for proper operation. It is the responsibility of the server
to allocate the reserved bits to those extensions that require them.
Because the server must know all extension requirements before
negotiating its use, requirements for mandatory or optional use of a
reserved frame bit is assumed to be known by the server. Extensions
that allocated a reserved frame bit will have that allocation included
in the response as a bit allocation header.

If an extension requires the use of one or more reserved bits but it
has not been allocated all required bits, the extension MUST NOT be
included in the list of negotiated extensions in the response. If an
extension can optionally use a reserved bit but it has not been
allocated the bit, the extension MAY be included in the list of
negotiated extensions but a bit allocation will not be present in the
response for that extension. The selection of extensions and
allocation of reserved frame bits to the extensions is at the
discretion of the server. Extensions MUST NOT depend on the reserved
bit staying the same as any previous allocation.

The server MUST return a bit reservation header, and include an entry
for each extension that has been allocated a reserved frame bit:

bit-reservation-header = "Sec-WebSocket-Reserved-Bits:" bit-allocation
bit-allocation = extension-token "=" allocated-bits
allocated-bits = bitnum *(";" bitnum)
bitnum = 1#digit

The bitnum is the number of the reserved bit corresponding to the
WebSocket protocol specification section 4.2 where "1" is RSV1, "2" is
RSV2, etc.

For example, to allocate RSV3 to deflate-payload and RSV1 to
mux-a-million would add the following two headers to the response:

Sec-WebSocket-Reserved-Bits: deflate-payload=3
Sec-WebSocket-Reserved-Bits: mux-a-million=1

Note that like other HTTP headers, this header MAY be split or
combined across multiple lines.  Ergo, the following header is
equivalent to the two headers above:

Sec-WebSocket-Reserved-Bits: deflate-payload=3, mux-a-million=1

If an extension has been allocated the use of multiple bits, multiple
allocations MUST follow it's token. An extension token MUST NOT appear
more than once in the Sec-WebSocket-Reserved-Bits header. For example,
if it assumed that the "mux-a-million" extension requires the use of a
single bit, but can optionally use another bit. If the server
allocates two bits to the extension, the following header may be
returned:

Sec-WebSocket-Reserved-Bits: mux-a-million=1;3

The order of the bits within the allocated-bits field is significant
and should be interpreted as appropriate by the extension. The order
of the bit-allocation fields within the Sec-WebSocket-Reserved-Bits is
not significant.

If an extension is negotiated which requires a frame bit, but the
server fails to allocate that frame bit, the client MUST disconnect.


However the allocation works, for the sake of extensibility of the
protocol, I think that we need to get some method of allocating these
bits into the spec before final. Note that I have used the Sec- header
prefix just for consistency with other headers.

Regards,
Brodie