[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

FastCGI parameters (get and post

JD

11/4/2004 8:59:00 PM

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.
20 Answers

Kent Sibilev

11/4/2004 9:27:00 PM

0

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.

On Nov 4, 2004, at 4:03 PM, J. D. wrote:

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



JD

11/4/2004 9:36:00 PM

0

Kent Sibilev wrote:
> 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.
>
> On Nov 4, 2004, at 4:03 PM, J. D. wrote:
>
>> 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).

Patrick May

11/5/2004 5:14:00 AM

0


On Thursday, November 4, 2004, at 04:38 PM, J. D. wrote:

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

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/P...

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

~ patrick



MoonWolf

11/5/2004 1:14:00 PM

0

Patrick May wrote:
>
> On Thursday, November 4, 2004, at 04:38 PM, J. D. wrote:
>
>> 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).
>
>
> 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/P...
>
> Of course, if you like the Narf API you could just use that.

Nora supports CGI/mod_ruby/FastCGI.

http://raa.ruby-lang.org/pro...

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
}


Kent Sibilev

11/5/2004 1:44:00 PM

0

Hm, download link goes to nowhere.

Cheers,
Kent.

On Nov 5, 2004, at 8:14 AM, MoonWolf wrote:
>
> Nora supports CGI/mod_ruby/FastCGI.
>
> http://raa.ruby-lang.org/pro...
>
> 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
> }
>



MoonWolf

11/5/2004 4:57:00 PM

0

thanx

URL: http://www.moonwolf.com/ruby/archive/nora-0.0.20041...

Japanese tutorial is here:
http://jp.rubyist.net/magazine/?0001-No...
http://jp.rubyist.net/magazine/?0002-No...
J to E machine-translation link:

http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ja_en&url=http://jp.rubyist.net/magazine/?0001-No...

http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=ja_en&url=http://jp.rubyist.net/magazine/?0002-No...

Kent Sibilev wrote:
> Hm, download link goes to nowhere.
>
> Cheers,
> Kent.
>
> On Nov 5, 2004, at 8:14 AM, MoonWolf wrote:
>
>>
>> Nora supports CGI/mod_ruby/FastCGI.
>>
>> http://raa.ruby-lang.org/pro...
>>
>> 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
>> }
>>



Patrick May

11/5/2004 6:40:00 PM

0

Quoting MoonWolf <moonwolf@moonwolf.com>:

> Nora supports CGI/mod_ruby/FastCGI.
>
> http://raa.ruby-lang.org/pro...
>
> 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
> }
>

We should figure out a way to work together.

~ patrick


gabriele renzi

11/5/2004 7:55:00 PM

0

Patrick May ha scritto:

> Quoting MoonWolf <moonwolf@moonwolf.com>:
>
>
>>Nora supports CGI/mod_ruby/FastCGI.
>>
>> http://raa.ruby-lang.org/pro...
>>
>>interface is automatic detect.
>>some interface works not need chagne source code.
<snip>

> We should figure out a way to work together.
>
> ~ patrick


funny how things are the same in every place.. Did ruby web devs ever
heard of python's WSGI ? It is an interface defined for web frameworks
to access web engines (such as mod_*, cgi, fcgi and random
webservers/containers).
A formal spec is here:
http://www.python.org/peps/pep...
I think having such a thing for ruby would be reqly useful..

Patrick May

11/6/2004 4:51:00 PM

0


On Friday, November 5, 2004, at 02:58 PM, gabriele renzi wrote:

> funny how things are the same in every place.. Did ruby web devs ever
> heard of python's WSGI ? It is an interface defined for web frameworks
> to access web engines (such as mod_*, cgi, fcgi and random
> webservers/containers).
> A formal spec is here:
> http://www.python.org/peps/pep...
> I think having such a thing for ruby would be reqly useful..

The actual interface layer between different engines is a small amount
of code:

http://www.narf-lib.org/doc/classes/We...

On top of that, there's alot of functionality you can write. Sharing
that more difficult b/c it is api, aka judgement call. Integrating
Narf and Nora and all the other cgi replacements, then we'd have a php
replacement.

I've integrated code from various other projects into Narf. If the
developers from those projects like the direction of Narf, then I'd
love to give them commit access.

I think that a rich, low-level web api would be a good thing.
Integrating WebUnit, Nora, Narf, Amrita all together I think would be
quite useful.

~ Patrick



Ara.T.Howard

11/6/2004 5:11:00 PM

0