httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@nueva.pvt.k12.ca.us>
Subject Re: CGIWrap Problems (fwd)
Date Tue, 29 Apr 1997 01:41:41 GMT
On Mon, 28 Apr 1997, Rob Hartill wrote:

>   ScriptAlias /cgi-bin/ /magma/web/cgi-bin/cgiwrapd/userid00/
> 
> calling the URL:
> 
>   /cgi-bin/test-cgi.pl/klgeddie/test
> 
> produces:
> 
>   SCRIPT_NAME: '/cgi-bin'
>   PATH_INFO: '/test-cgi.pl/klgeddie/test'
>   PATH_TRANSLATED: '/magma/users/u20/userid00/public_html/userid00/test-cgi.pl/klgeddie/test'

This is a feature. As others have said, I changed this in 1.2. The
path_info stuff needed to be changed to prevent core dumps, and I
realized that the only way to make it intiutive and still work with
the weird URL rewriting people do nowadays was do to it the way it is
above; the CGI spec doesn't really deal with this situation (I suppose
at the time it was written, most URLs were a straight one-to-one URL
to filename translation), and various servers do it differntly. Our
way is perfectly legal.

As others have said, the pre-1.2 PATH_INFO is available in
FILEPATH_INFO. PATH_TRANSLATED is the same as it always was, and there
is no way to generate an old-style SCRIPT_NAME without allowing the
user to induce core dumps (or at least malformed results).

BTW, my rationale for the specific way it's implemented now is that
http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME$PATH_INFO?$QUERY_STRING
should point to the exact same URL that's being accessed at the
time. This was not the case in the pre-1.2 behavior, but is the case
now.

Maybe this should be in the FAQ, as some scripts (like cgiwrap) assume
the old-style behavior, where the file-based path info was assumed to
be the same as the URL-based path info, and PATH_INFO was generated
that way. (however, this assumption means that for cases like the
above ScriptAlias, the given request would result in a core dump.) The
proper behavior to work with both old and new servers, if you *really*
need this information (of course, the proper way to address this would
be to use something like SetEnv, not to store the information in a
"hidden" part of the URL, so this is a hack anywy) you'd want to use
something like this (e.g. Perl):

$path_info = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};

Hopefully that explains it.

-- 
________________________________________________________________________
Alexei Kosut <akosut@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/


Mime
View raw message