Websocket Handshake 76

Eric Wong normalperson at yhbt.net
Wed Jul 7 16:38:49 EDT 2010

Niklas Hofer <niklas+rainbows at lanpartei.de> wrote:
> Hey
>  I just tried to implement the new Websocket Handshake [1] into
> Rainbows/Sunshowers. I think I almost succeeded (tests and chrome
> passing), but I had to hack something and I want your opinion over it:
>  In order to complete the new handshake, the server must use 8 bytes
> from the incoming body. Because Rainbows uses the HTTPParser and
> checking for the "Content-Length" field and the HTTP-like Websocket
> request does not supply such a field, no body is forwarded to the
> underlying app stack. (0.94.0: lib/rainbows/base.rb:72).
> My suggestion: Set an unused key in the env, for example 'hack.buf' and
> use this in lib/sunshowers/websocket.rb.
> Is this the right way (TM)?
> May there be a better name for the env key?

Hi Niklas,

I haven't gotten a chance to look into the new WebSocket updates, but
can't you just read the 8 bytes off env["rack.input"]?


Eric Wong

More information about the rainbows-talk mailing list