Re: [hybi] [whatwg] Web sockets and existing HTTP stacks

Greg Wilkins <gregw@webtide.com> Sat, 19 December 2009 00:25 UTC

Return-Path: <gregw@webtide.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 60B213A690A for <hybi@core3.amsl.com>; Fri, 18 Dec 2009 16:25:25 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[AWL=0.000, 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 9Ij5Mzndvj+X for <hybi@core3.amsl.com>; Fri, 18 Dec 2009 16:25:24 -0800 (PST)
Received: from mail-yx0-f192.google.com (mail-yx0-f192.google.com [209.85.210.192]) by core3.amsl.com (Postfix) with ESMTP id 2AB523A68F5 for <hybi@ietf.org>; Fri, 18 Dec 2009 16:25:24 -0800 (PST)
Received: by yxe30 with SMTP id 30so4106649yxe.29 for <hybi@ietf.org>; Fri, 18 Dec 2009 16:25:06 -0800 (PST)
Received: by 10.91.14.10 with SMTP id r10mr5192490agi.5.1261182306449; Fri, 18 Dec 2009 16:25:06 -0800 (PST)
Received: from ?10.10.1.11? (60-242-119-126.tpgi.com.au [60.242.119.126]) by mx.google.com with ESMTPS id 13sm1721818gxk.5.2009.12.18.16.25.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 18 Dec 2009 16:25:05 -0800 (PST)
Message-ID: <4B2C1D52.9020505@webtide.com>
Date: Sat, 19 Dec 2009 11:24:50 +1100
From: Greg Wilkins <gregw@webtide.com>
User-Agent: Thunderbird 2.0.0.23 (X11/20090817)
MIME-Version: 1.0
To: Ian Hickson <ian@hixie.ch>
References: <557ae280911171402v7546e5e7n93a1e57f87dc10e5@mail.gmail.com> <557ae280911200711i5493e654k67c1f5f07336bfb9@mail.gmail.com> <Pine.LNX.4.62.0912032347360.15540@hixie.dreamhostps.com>
In-Reply-To: <Pine.LNX.4.62.0912032347360.15540@hixie.dreamhostps.com>
X-Enigmail-Version: 0.95.7
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
Cc: whatwg@whatwg.org, Boris Zbarsky <bzbarsky@mit.edu>, hybi@ietf.org, wfernandom2004@gmail.com
Subject: Re: [hybi] [whatwg] Web sockets and existing HTTP stacks
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: Sat, 19 Dec 2009 00:25:25 -0000

Ian Hickson wrote:
> On Tue, 17 Nov 2009, Christian Biesinger wrote:
>> Is it intentional that it is impossible to implement this spec over an 
>> existing HTTP stack, as currently specified?
> 
> Only to the same extent that it is "intentional" that it's impossible to 
> implement Telnet or SSH over an existing HTTP stack.

Telnet and SSH don't use the HTTP port and don't start with a "legal"
HTTP request.

To support websocket in Jetty, we had to use our existing HTTP stack because
we don't know that the request is a websocket upgrade until we have
already accepted it and parsed it using our existing HTTP stack.


>> In particular, due to the strict requirements on the headers to send, it 
>> seems like you can't really implement it with an existing HTTP stack. On 
>> the other hand, you really do want to reuse your HTTP implementation, 
>> because otherwise you have to reimplement all your HTTP proxy 
>> authentication, including NTLM, GSSAPI, etc. Obviously another problem 
>> would be that the actual bidirectional communication might be hard to 
>> fit into your HTTP implementation, but that might be easier to work 
>> around.
> 
> Yeah, it's likely that the code reuse theoretically made possible by 
> reusing the HTTP proxy and cookie infrastructure is more theoretical than 
> practical in many cases. I had hoped that it would be easier.

With the Jetty Websocket server, we were able to reuse the HTTP stack
for the websocket upgrade.

But we had to put a number of hacks into the base HTTP code to handle
the restrictions of the websocket spec with regards to the ordering
of headers etc.

These restrictions add nothing but pain and complication.


regards