Path_info

PATH_INFO is supposed to be decoded by the server and then passed to
the CGI application.

How can I do that from nginx. My PATH_INFO never gets decoded and it
throws off my CGI scripts.

best,

dd

Yeah, I’m passing everything to FastCGI.

I’m using something similar to this:

location .php(/|$) {

fastcgi_param SCRIPT_FILENAME /path*/to/*$script_name;
fastcgi_param PATH_INFO $path_info;
}

but really $path_info should be url_decoded before being set as a
fastcgi_param. Since the CGI spec says:

The extra path information, as given by the client. In other words,
scripts

can be accessed by their virtual pathname, followed by extra information at
the end of this path. The extra information is sent as PATH_INFO. This
information should be decoded by the server if it comes from a URL before it
is passed to the CGI script.

But is there a way that I can just do

fstcgi_param PATH_INFO urldecode($path_info); ?

Dave,

There is no support for CGI in Nginx. You have to FastCGI or HTTP 

(proxy)


Aníbal Rojas
http://hasmanydevelopers.com
http://rubycorner.com
http://anibal.rojas.com

On Wed, 2008-01-23 at 09:56 -0800, Dave Dash wrote:

but really $path_info should be url_decoded before being set as a
fastcgi_param. Since the CGI spec says:

    The extra path information, as given by the client. In other
    words, scripts can be accessed by their virtual pathname,
    followed by extra information at the end of this path. The
    extra information is sent as PATH_INFO. This information
    should be decoded by the server if it comes from a URL before
    it is passed to the CGI script.

From php.ini:

; cgi.fix_pathinfo provides real PATH_INFO/PATH_TRANSLATED support for
CGI. PHP’s
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and
to not grok
; what PATH_INFO is. For more information on PATH_INFO, see the cgi
specs. Setting
; this to 1 will cause PHP CGI to fix it’s paths to conform to the spec.
A setting
; of zero causes PHP to behave as before. Default is 1. You should fix
your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.

Try setting

cgi.fix_pathinfo=0

in php.ini

Regards,
Cliff

Try setting

cgi.fix_pathinfo=0

in php.ini

Regards,

Nope, that doesn’t work either. I instead opted to use a PHP script to
urldecode the data (using the prepend options in php.ini). It works for
now, not ideal, but I get to use nginx.

Anibal,

I am using a FastCGI server that nginx calls. Right now (through
regexp) it takes the URL and figures out what part is the script
(blah.php) and what’s the pathinfo (/q/string as in http://nginx/
blah.php/q/string).

But I need to decode the PATH_INFO before I pass it as a fast_Cgi
param. is their a way to do that?

On Jan 24, 2008, at 7:25 AM, Aníbal Rojas wrote:

Dave Dash
Eat smarter… www.reviewsby.us

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs