To reproduce, create a new rails application with simple "render :text => 'Ok'" action and run "mongrel_rails start".
$ mongrel_rails start
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
** Rails signals registered. HUP => reload (without restart). It might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.
Tue May 25 20:24:52 +0300 2010: Error calling Dispatcher.dispatch #
You might have expected an instance of Array.
The error occurred while evaluating nil.split>
/Users/be/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/cgi_process.rb:54:in `dispatch_cgi'
/Users/be/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
/Users/be/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:27:in `dispatch'
/Users/be/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in `process'
/Users/be/.gem/ruby/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `synchronize'
This actually looks like a bug in Mongrel, specifically their handling off cookies when @head['cookies'] is a string
In lib/mongrel/cgi.rb, there is a bug in send_cookies. When @head['cookies'] is an array or a hash, it iterates over the values and to_s's them, but when it's something else and tries to to_s the value of options['cookie'].
Fix:-
The simple change of modifying line 110 of cgi.rb
from
to['Set-Cookie] = options['cookie'].to_s
to
to['Set-Cookie] = cookie.to_s
You should not be facing any problems for send cookies then :)
No comments:
Post a Comment