Re: [hybi] CONNECT vs UPGRADE as method for handshake

Zhong Yu <zhong.j.yu@gmail.com> Fri, 12 November 2010 18:17 UTC

Return-Path: <zhong.j.yu@gmail.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 EBE473A6B35 for <hybi@core3.amsl.com>; Fri, 12 Nov 2010 10:17:31 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.429
X-Spam-Level:
X-Spam-Status: No, score=-2.429 tagged_above=-999 required=5 tests=[AWL=0.170, BAYES_00=-2.599]
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 pOomA-a9vTT4 for <hybi@core3.amsl.com>; Fri, 12 Nov 2010 10:17:31 -0800 (PST)
Received: from mail-ww0-f44.google.com (mail-ww0-f44.google.com [74.125.82.44]) by core3.amsl.com (Postfix) with ESMTP id ED5EE3A6A77 for <hybi@ietf.org>; Fri, 12 Nov 2010 10:17:30 -0800 (PST)
Received: by wwb22 with SMTP id 22so130166wwb.13 for <hybi@ietf.org>; Fri, 12 Nov 2010 10:18:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=MnQXITC3uVDdkfBjoho+jNyg2WDaTKZ1tVyCFTnEvSo=; b=paTOIqD6GtEibshSvaFIYN2Q5GCyQ3en7etJ38i5DgP+o7NPhbDPcv+DeRtrLNpHCi duoMnBdqppZU8rm3oGWTjzDkjRJax1+inZUz7/VYWfY/sUpAvefkc8OItTIeMrIvd2u1 GWtNChOMtZWUKpTSgYSWTHS/e9bE3CbTwqPCY=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=kM91UMMQVTBQjMgpCj28fs7394E1Ldh7JNgFk2fowXk95Zq/K7VZsmz5pNwgbmBfIR U10MlZEGORrac8+opSKoHymMeVm7iYQIBY336POCOEVtO3+xh6RbK5XuGE98aNJshAJg OLE18+O2r8VmIyK1Q/A7WYGHPa83eemgtvhfw=
MIME-Version: 1.0
Received: by 10.216.168.194 with SMTP id k44mr2351090wel.58.1289585882750; Fri, 12 Nov 2010 10:18:02 -0800 (PST)
Received: by 10.216.54.129 with HTTP; Fri, 12 Nov 2010 10:18:02 -0800 (PST)
In-Reply-To: <AANLkTin_Yqf87yneZzeRTGYXVCoUhp=4pgVSuHRzS=OB@mail.gmail.com>
References: <4CD6D244.3050203@ericsson.com> <AANLkTin_Yqf87yneZzeRTGYXVCoUhp=4pgVSuHRzS=OB@mail.gmail.com>
Date: Fri, 12 Nov 2010 12:18:02 -0600
Message-ID: <AANLkTikNOoqEpMySv43z-W_JRZTFPh58Ks9i_AR_nqRT@mail.gmail.com>
From: Zhong Yu <zhong.j.yu@gmail.com>
To: Salvatore Loreto <salvatore.loreto@ericsson.com>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] CONNECT vs UPGRADE as method for handshake
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: Fri, 12 Nov 2010 18:17:32 -0000

On Fri, Nov 12, 2010 at 12:03 PM, Zhong Yu <zhong.j.yu@gmail.com> wrote:
> How about CONNECT + Upgrade?
>
>  CONNECT example.com:80 HTTP/1.1
>  Host: example.com
>  Upgrade: WebSocket
>
> CONNECT and "Host" usages follow existing conventions. "Upgrade:
> WebSocket" is simply to flag the connection as WS.
>
> WS server must respond with
>
>  HTTP/1.1 200 OK
>  Upgrade: WebSocket
>
> That takes care of the tunneling part. The meat of WS handshake should
> be done in the next two WS frames. A pure WS server doesn't need to be
> HTTP savvy. It can treat the HTTP request part as historical magic
> bits that ends with \r\n\r\n, bypass and ignore it, and return the

scratch that. that's a really bad idea. the server must validate
something in the HTTP request to make sure it's from a WS client.

> fixed HTTP response as another historical magic bits. After that, the
> "real" WS handshake is done in the WS language.
>
> - Zhong Yu
>