[whatwg] Web sockets and existing HTTP stacks
ian at hixie.ch
Thu Dec 3 15:57:02 PST 2009
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
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.)
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg