From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=1.0 required=3.0 tests=AWL,HK_RANDOM_FROM, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: Websocket Handshake 76 Date: Wed, 7 Jul 2010 13:38:49 -0700 Message-ID: <20100707203848.GA21844@dcvr.yhbt.net> References: <20100707172640.26fe0ce8@wigowyr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1278535138 26644 80.91.229.12 (7 Jul 2010 20:38:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 7 Jul 2010 20:38:58 +0000 (UTC) To: Rainbows! list Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Wed Jul 07 22:38:56 2010 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Content-Disposition: inline In-Reply-To: <20100707172640.26fe0ce8@wigowyr> User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:94 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OWbOS-0007JE-E5 for gclrrg-rainbows-talk@m.gmane.org; Wed, 07 Jul 2010 22:38:56 +0200 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id CF8341858267; Wed, 7 Jul 2010 16:38:55 -0400 (EDT) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 0FA9D1858267 for ; Wed, 7 Jul 2010 16:38:49 -0400 (EDT) Received: from localhost (unknown [127.0.2.5]) by dcvr.yhbt.net (Postfix) with ESMTP id 3C449296AA0; Wed, 7 Jul 2010 20:38:49 +0000 (UTC) Niklas Hofer 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"]? env["rack.input"].read(8) -- Eric Wong _______________________________________________ Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org http://rubyforge.org/mailman/listinfo/rainbows-talk Do not quote signatures (like this one) or top post when replying