Cgi / fcgi?

Forgive me for my newbiness. I’ve never had to deal with cgi’s before. I
understand that fcgi is supposed to make cgi faster. But in the case of
ruby, when i’m handling a request that was made to an fcgi. Do I handle
it through the CGI apis? I don’t quite see how to handle one through
fcgi? To me FCGI seems to be just the fcgi server?

For example, in my fcgi script. I’ve only been able to figure out how to
grab request data through cgi = CGI.new. then accessing params and what
not through that. Is that correct?

-thanks.

On Mon, 19 Feb 2007 07:18:16 +0100, Aaron S.
[email protected] wrote:

-thanks.

Your Ruby script needs to run a FCGI binding / listener / dispatcher /
whatevertheheck too, which I think [1] provides its own mechanism for
doing this, hopefully reasonably compatible with the standard CGI
library.
Considering you don’t mention doing that, I’m going out on a limb here
and
suspect the superior FCGI process degrades gracefully to regular CGI in
your case.

David V.

[1] Can’t for the heck of it google up any documentation myself, and
don’t
quite feel like wading through the source in hopes there’s rdoc around.

I’ve been looking at rails source code. The way I see it. I need to use
something similar to the spawner, which creates the fcgi processes. Then
inside of another script. Say gateway.fcgi. I trap all the different
signals that come from an fcgi request.

it appears in the rails source that if the signal is USR1 he is then
calling Dispatcher, which in turn executes the application and gets the
response.

then in a lighttpd config, I can specify all three different process and
how to handle them, or however many processes I spawn.

like so:

fastcgi.server = ( “.fcgi” =>
( “localhost-8000” => ( “host” => “127.0.0.1”, “port” => 8000 ) ,
“localhost-8001” => ( “host” => “127.0.0.1”, “port” => 8001 ) ,
“localhost-8002” => ( “host” => “127.0.0.1”, “port” => 8002 ) )
)

make sense? Can it be easier then that? I’m thinking that the way rails
sets this up is for multi threading so that one request doesn’t lock the
application until that request is complete.

-thanks.