[Nitro] Nitro and Apache.

James Britt james_b at neurogami.com
Fri Oct 21 23:51:17 EDT 2005

Walter wrote:
> Can anyone point me to any docs of using Nitro With Apache.
> I currently have an Apache server (Apache/2.0.52 running on Windows) that runs as a service and I use to execute other ruby based CGI scripts.

> If I type in http://nitro:8080/ I do get the index page of the TestController.  And if I type in http://nitro:8080/legalListForDrivers I do get the index page of the LegalListForDriversController.  The problem is if I enter data into the form fields and submit it, I seem to be getting errors reading in the data passed in.
> [Wed Oct 12 13:00:18 2005] [error] [client] Premature end of script headers: cgi.cgi, referer: http://nitro:8080/legalListForDrivers/
> [Wed Oct 12 13:00:18 2005] [error] [client] c:/ruby/lib/ruby/gems/1.8/gems/nitro-0.23.0/lib/nitro/adapter/cgi.rb:227:in `parse_params': undefined method `binmode' for nil:NilClass (NoMethodError)\r, referer: http://nitro:8080/legalListForDrivers/

I'm using Nitro 0.23, and maybe this is fixed in .24, but I was getting 
the same error in an app I just started.  It seems that, when processing 
a post, the cgi code expects the context to have an 'in' attribute.  It 
doesn't (or doesn't always), so trying to call 'binmode' fails.  As do 
subsequent calls to read from that nonexistent 'in' attribute, if you 
simply try to sidestep that line (which I tried first).

Since this happens at the point where the cgi code is trying to parse 
the query string, I wrote a hack that catches exceptions and then just 
grabs the QUERY_STRING from the headers available from the context.

I discover this using some prototype.js Updater calls that apparently 
makes a POST even though I'm not passing any POST data, just a query string.



http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com  - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com  - Playing with Better Toys

More information about the Nitro-general mailing list