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

Zhong Yu <zhong.j.yu@gmail.com> Fri, 12 November 2010 18:02 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 345EC3A6A4C for <hybi@core3.amsl.com>; Fri, 12 Nov 2010 10:02:39 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.385
X-Spam-Level:
X-Spam-Status: No, score=-2.385 tagged_above=-999 required=5 tests=[AWL=0.214, 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 yzah9aMDisVJ for <hybi@core3.amsl.com>; Fri, 12 Nov 2010 10:02:38 -0800 (PST)
Received: from mail-ey0-f172.google.com (mail-ey0-f172.google.com [209.85.215.172]) by core3.amsl.com (Postfix) with ESMTP id 364683A69E9 for <hybi@ietf.org>; Fri, 12 Nov 2010 10:02:38 -0800 (PST)
Received: by eyd10 with SMTP id 10so2125309eyd.31 for <hybi@ietf.org>; Fri, 12 Nov 2010 10:03:11 -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; bh=a8fgog+4A+nC00nXrcy1zPM21YBkeKrzJ62lssDP4tw=; b=CbMSRztgoY/5fyPJlwjsY7/n8P7pEyK0agjV4X3pFByWwdP+UkGu3uDmTU42Z9ck/4 mDqqxKgqa78JBthfYSCU7jbsIfUWMWVkinEYTTSnhwJjFgTByLLVY7ti0jqYY2PKP+KQ xZwXdDOHlvLQNPLX1T+N2zTZF4UUGOLLkqgpI=
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; b=umj742eK5BrFvgZyI962DfmPRp+6VkrfNoI6e59e3S7AcOAXe2wRiiQykf2E9j14gL BbrmJO3i4fpztOFT1M+XjbvsgUUtELkrmOEAjxLoVFJGLodN3HCwG9rOIRY+FvwBRkQl WgZxu5QcXbVx/tLrfu0LroV9AlO+p6zItsiE0=
MIME-Version: 1.0
Received: by 10.216.47.196 with SMTP id t46mr3966147web.13.1289584989830; Fri, 12 Nov 2010 10:03:09 -0800 (PST)
Received: by 10.216.54.129 with HTTP; Fri, 12 Nov 2010 10:03:09 -0800 (PST)
In-Reply-To: <4CD6D244.3050203@ericsson.com>
References: <4CD6D244.3050203@ericsson.com>
Date: Fri, 12 Nov 2010 12:03:09 -0600
Message-ID: <AANLkTin_Yqf87yneZzeRTGYXVCoUhp=4pgVSuHRzS=OB@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"
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:02:39 -0000

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
fixed HTTP response as another historical magic bits. After that, the
"real" WS handshake is done in the WS language.

- Zhong Yu