Websocket Handshake 76

Niklas Hofer niklas+rainbows at lanpartei.de
Wed Jul 7 11:26:40 EDT 2010


 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?

with regards,


 _ o                         o    |    o       >    =            o)
  /\    - =   <             (|/   |   \|)               \       (| 
 | \                        /)    |    (\          \  _ /       / \
The game of life is a game of boomerangs.  Our thoughts, deeds and words
return to us sooner or later with astounding accuracy.

More information about the rainbows-talk mailing list