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

Ian Hickson <ian@hixie.ch> Thu, 03 December 2009 23:57 UTC

Return-Path: <ian@hixie.ch>
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 B879B3A6886 for <hybi@core3.amsl.com>; Thu, 3 Dec 2009 15:57:13 -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=[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 ghXbESg0qB14 for <hybi@core3.amsl.com>; Thu, 3 Dec 2009 15:57:12 -0800 (PST)
Received: from looneymail-a2.g.dreamhost.com (caibbdcaaaaf.dreamhost.com [208.113.200.5]) by core3.amsl.com (Postfix) with ESMTP id E6C3E3A6836 for <hybi@ietf.org>; Thu, 3 Dec 2009 15:57:12 -0800 (PST)
Received: from hixie.dreamhostps.com (hixie.dreamhost.com [208.113.210.27]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by looneymail-a2.g.dreamhost.com (Postfix) with ESMTP id 9DF1216D41C; Thu, 3 Dec 2009 15:57:04 -0800 (PST)
Date: Thu, 03 Dec 2009 23:57:02 +0000
From: Ian Hickson <ian@hixie.ch>
To: Christian Biesinger <cbiesinger@gmail.com>
In-Reply-To: <557ae280911200711i5493e654k67c1f5f07336bfb9@mail.gmail.com>
Message-ID: <Pine.LNX.4.62.0912032347360.15540@hixie.dreamhostps.com>
References: <557ae280911171402v7546e5e7n93a1e57f87dc10e5@mail.gmail.com> <557ae280911200711i5493e654k67c1f5f07336bfb9@mail.gmail.com>
Content-Language: en-GB-hixie
Content-Style-Type: text/css
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset="US-ASCII"
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: Thu, 03 Dec 2009 23:57:13 -0000

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.


> 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.

I guess it might still be possible if the relevant code can be abstracted 
out somehow, but that might result in code that feels a little twisted.

It's not clear what to do about this; we could limit the proxy support to 
just SOCKS, but that seems suboptimal.


(Similar problems exist on the server-side if you try to use an HTTP stack 
to implement WebSocket, though on that side there is far less reason to do 
so, since there's no proxy code to reuse and the cookie code that could be 
reused is minimal and more easily abstractable. The problem only really 
exists in the more advanced case of sharing a port with an HTTP server. 
The complexity there is considered acceptable because few people should 
ever have to write that code, compared to the number of people writing a 
straight WebSocket server.)

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'