Issue with String in 1.9.1

I was trying to see if I can Rack to work with 1.9.1. The only web server I can use is WEBrick since Mongrel as well as Thin does not work with 1.9.1. Rack installed without a hitch using ‘gem install rack’ command.

Using extremely simple code below, I wanted to see if I can hit my new super micro app.

[sourcecode language="ruby"]
super_micro_app = Proc.new { |env| [200, {'Content-Type' => 'text/plain'},'Please no more hello world crap'] }
require ‘rack’
Rack::Handler::WEBrick.run(super_micro_app, :Port => 4000)
[/sourcecode]

The problem is that this will barf because of the fact that String is no longer Enumerable. On line 47 of rack/handler/webrick.rb, you’ll see that each is called on ‘vs’ variable. Same thing happens on line 47 with ‘body’. The way I made this run is to change ‘vs.each’ to ‘vs.each_char’ on line 40 and ‘body.each’ to ‘body.each_line’ on line 47.

Of course this is a temporary fix just to run my stupid super micro app. But the lesson here is that String in 1.9.1 has changed lot more than I originally expected.

Comments

Comments are closed.

Powered by Olark