Forum: Ruby cgi / fcgi?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5e8fd591aeccbffd6fc93c171ac4fa43?d=identicon&s=25 Aaron Smith (warhero)
on 2007-02-19 07:18
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.
430ea1cba106cc65b7687d66e9df4f06?d=identicon&s=25 David Vallner (Guest)
on 2007-02-19 12:12
(Received via mailing list)
On Mon, 19 Feb 2007 07:18:16 +0100, Aaron Smith
<beingthexemplary@gmail.com> 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 Vallner

[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.
5e8fd591aeccbffd6fc93c171ac4fa43?d=identicon&s=25 Aaron Smith (warhero)
on 2007-02-19 20:07
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.
This topic is locked and can not be replied to.