FastCGI parameters (get and post)

J

J. D.

Hi,

How do I retrieve form parameters with FCGI in a way that works for both
GET and POST?

I'm using FCGI.each{|request| ...} and trying to avoid the need to use
the CGI object.
 
K

Kent Sibilev

GET parameters you have to parse from ENV['QUERY_STRING'].
POST parameters you parse from standard input. It gets more complicated
for multipart forms though.

CGI object provides you with exactly this functionality. I wonder does
it make sense to implement CGI class as a native extension?

Cheers,
Kent.
 
J

J. D.

Kent said:
GET parameters you have to parse from ENV['QUERY_STRING'].
POST parameters you parse from standard input. It gets more complicated
for multipart forms though.

CGI object provides you with exactly this functionality. I wonder does
it make sense to implement CGI class as a native extension?

Cheers,
Kent.

Hi,

How do I retrieve form parameters with FCGI in a way that works for
both GET and POST?

I'm using FCGI.each{|request| ...} and trying to avoid the need to use
the CGI object.

I see. So I guess, I'd have to do a $stdin = req.in and manually parse
in order to handle POST requests using FCGI (if I want to avoid using
CGI object).
 
M

MoonWolf

Patrick said:
You might be able to hack something from bits of Narf. The parsing
methods are in a module Web::parser:

http://www.narf-lib.org/doc/classes/Web/Parser.html

Of course, if you like the Narf API you could just use that.

Nora supports CGI/mod_ruby/FastCGI.

http://raa.ruby-lang.org/project/nora/

interface is automatic detect.
some interface works not need chagne source code.

example:

#!/usr/bin/env ruby
require 'web'
api = Web::Interface::AUTO.new
api.each {|request|
response = Web::Response.new
api.response request, response
}
 

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,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top