[Nitro] class CgiUtils missing?
James Britt
james_b at neurogami.com
Sun Nov 13 01:15:24 EST 2005
George Moschovitis wrote:
>>Is there a real solution for this?
>>
>>I really want to get some Nitro apps up and running, as CGI under Apache
>>2, but while code runs fine on Windows, it barfs on Linux.
>>
>>...
>>
>>Anyway, some suggestions on getting a real solution for the CGI issue
>>would be much appreciated.
>
>
>
> Hello James,
>
> Is it possible that you could investigate this further? As I am not
> using CGI and cannot easily setup an environment to test this, it
> would be really helpful. GGI is only problematic on Linux?
>
I have problems on Windows as well.
Here's what I've done (in the 0.24 gems code):
In file lib/nitro/cgi.rb, changed
context.headers = cgi.env
to
context.headers = ENV
And in file lib/nitro/adapter/cgi.rb, I have
Cgi.process(server, cgi, cgi, cgi)
I *think* this use to be CgiUtils.process. I forgot to track all my
changes.
So this gets me further. But when I run a minimal app created by
'nitrogen app', I get errors in Nitro::Controller about index_action
missing.
DEBUG -- : Compiling action 'Nitro::Controller#index'\r
ERROR -- : Error while handling '/'.\r
ERROR -- : undefined method `index_action' for
#<Nitro::Controller:0x32501a0>\r
[Sat Nov 12 23:04:42 2005] [error] [client 127.0.0.1]
C:/ruby/lib/ruby/gems/1.8/gems/nitro-0.24.0/lib/nitro/controller.rb:107:in
`method_missing'\r
[Sat Nov 12 23:04:42 2005] [error] [client 127.0.0.1]
C:/ruby/lib/ruby/gems/1.8/gems/nitro-0.24.0/lib/nitro/render.rb:125:in
`send'\r
[Sat Nov 12 23:04:42 2005] [error] [client 127.0.0.1]
C:/ruby/lib/ruby/gems/1.8/gems/nitro-0.24.0/lib/nitro/render.rb:125:in
`render'\r
[Sat Nov 12 23:04:42 2005] [error] [client 127.0.0.1]
C:/ruby/lib/ruby/gems/1.8/gems/nitro-0.24.0/lib/nitro/cgi.rb:35:in
`process'\r
[Sat Nov 12 23:04:42 2005] [error] [client 127.0.0.1]
C:/ruby/lib/ruby/gems/1.8/gems/nitro-0.24.0/lib/nitro/adapter/cgi.rb:18:in
`start'\r
[Sat Nov 12 23:04:42 2005] [error] [client 127.0.0.1]
C:/ruby/lib/ruby/gems/1.8/gems/nitro-0.24.0/lib/nitro/server/runner.rb:242:in
`invoke'\r
[Sat Nov 12 23:04:42 2005] [error] [client 127.0.0.1]
C:/ruby/lib/ruby/gems/1.8/gems/nitro-0.24.0/lib/nitro/server.rb:123:in
`run'\r
[Sat Nov 12 23:04:42 2005] [error] [client 127.0.0.1]
C:/ruby/lib/ruby/site_ruby/1.8/nitro.rb:65:in `run'\r
And then the same sort of stuff for error_action.
My run.rb is this:
#!/usr/bin/env ruby
require 'nitro'
Nitro.run
So it seems the default controller knows nothing about index. But I've
yet to hear of anyone else mention this, so perhaps this is just a
side-effect of my CGI changes. Or no one is running the default run.rb
file.
If I try this:
#!/usr/bin/env ruby
require 'nitro'
class MainController < Nitro::Controller
def index
end
end
Nitro.run( MainController )
then I just get a blank page, although there is an index.xhtml file in
/public.
And this simply works:
#!/usr/bin/env ruby
require 'rubygems'
require_gem 'nitro', '<0.24.0'
Nitro.run
Maybe I just need to replace the 0.24 cgi.rb files with those from 0.23?
James
More information about the Nitro-general
mailing list