cgi / fcgi?

A

Aaron Smith

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.
 
D

David Vallner

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 o= f
ruby, when i'm handling a request that was made to an fcgi. Do I handl= e
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 =3D CGI.new. then accessing params and w= hat
not through that. Is that correct?

-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 librar=
y. =

Considering you don't mention doing that, I'm going out on a limb here a=
nd =

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.
 
A

Aaron Smith

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,112
Latest member
VinayKumar Nevatia
Top