[hybi] extension params (was draft-10 questions)

Brodie Thiesfield <brodie@jellycan.com> Mon, 01 August 2011 00:23 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 0145121F8841 for <hybi@ietfa.amsl.com>; Sun, 31 Jul 2011 17:23:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.977
X-Spam-Level:
X-Spam-Status: No, score=-2.977 tagged_above=-999 required=5 tests=[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 KDJplF9PuvJ3 for <hybi@ietfa.amsl.com>; Sun, 31 Jul 2011 17:23:50 -0700 (PDT)
Received: from mail-pz0-f53.google.com (mail-pz0-f53.google.com [209.85.210.53]) by ietfa.amsl.com (Postfix) with ESMTP id 7086921F84FC for <hybi@ietf.org>; Sun, 31 Jul 2011 17:23:50 -0700 (PDT)
Received: by pzk6 with SMTP id 6so9752587pzk.26 for <hybi@ietf.org>; Sun, 31 Jul 2011 17:23:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=jv1FK0Jr0VjXMiYoeCGGw2L/DLWczfNrdwTSjhZp7CA=; b=Tm6F/jnGEwIv/tawydJuOh0BsQK42pJCJp1lYLfzpQYLN73me/l7L0kmKAkwHPttcM edRP8MTWIZhdEuttYahfNJRlRTaDB3qJaBNta9bw7903r6+uAQOcE1AW7unjkLelWwSX Gfphs1JlBqXTzrulOR+wfu0/2Rkbwo3TFL9zI=
MIME-Version: 1.0
Received: by 10.68.64.137 with SMTP id o9mr6516994pbs.203.1312158235152; Sun, 31 Jul 2011 17:23:55 -0700 (PDT)
Sender: brofield@gmail.com
Received: by 10.68.56.233 with HTTP; Sun, 31 Jul 2011 17:23:55 -0700 (PDT)
Date: Mon, 01 Aug 2011 09:23:55 +0900
X-Google-Sender-Auth: 72KXiKULmVgl_qiNJLca--WLYTE
Message-ID: <CAMY5452DoLdw_znttJ_quntoGwK8RdTMF3QoE_kU8k81DveLiw@mail.gmail.com>
From: Brodie Thiesfield <brodie@jellycan.com>
To: hybi@ietf.org
Content-Type: text/plain; charset="ISO-8859-1"
Subject: [hybi] extension params (was draft-10 questions)
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: Mon, 01 Aug 2011 00:23:51 -0000

All,

During the recent IETF meeting the format of the websocket extension
header parameters was brought up. The issue being should the header
follow the rules of HTTP (allowing quoted strings) or the simplified
rules of websocket draft (allowing only tokens).

On Mon, Aug 1, 2011 at 1:02 AM, Patrick McManus <pmcmanus@mozilla.com> wrote:
> On Sun, 2011-07-31 at 06:13 -0700, Tobias Oberstein wrote:
>> 2.
>> In the context of a persistent http connection, what is allowed _before_ the WebSocket handshake
>> (that is before client sends GET with upgrade header)?
>
> prior to the 101 the connection is http. So yes, you can send the
> bootstrap http request on a reused http connection. You can do anything
> HTTP allows you to do, because the handshake is carried out over HTTP.
> That's the point of reusing the infrastructure.

Since a websocket connection is plain HTTP prior to upgrade, then a
server supporting normal HTTP requests on a connection (i.e. not a WS
specific server) will already be using its full HTTP parser.

It is not possible to determine what is a WS upgrade message until the
headers have already been parsed, e.g. the following message is a
valid upgrade but that is not known until the last byte is parsed.
Additionally, take away the "Upgrade" header from the end and it is a
plain HTTP GET with some unnecessary headers.

        GET /chat HTTP/1.1
        Host: server.example.com
        Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
        Sec-WebSocket-Origin: http://example.com
        Sec-WebSocket-Protocol: chat, superchat
        Sec-WebSocket-Version: 8
        Connection: Upgrade
        Upgrade: websocket

The WS headers have already been parsed by the HTTP parser. Unless the
special parsing of the Sec-Websocket-Extension depends solely on the
header key, there can be no special parsing. If it does depend on the
header key, then won't this require a change to the HTTP spec to
introduce the rule that this header key is parsed specially? If it was
so defined, then every header key of every HTTP message will need to
be examined to see if it requires the simplified parsing.

If a WS only handshake is ever defined, then all limitations can be
decided here, but since the current handshake is using HTTP for
bootstrapping, I don't think that we can specify any format for any
part of the upgrade message that differs from HTTP.

Of course, a server implementation may not implement a full HTTP
parser and return a 400 error on quoted string, but for the spec I
believe that we are bound by their spec until the protocol has been
switched to WS.


Regards,
Brodie