httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@ast.cam.ac.uk (David Robinson)
Subject Re: CGI specification (was Re: restructuring the server)
Date Fri, 28 Apr 1995 11:40:00 GMT
Rst wrote:
>Hmmm... The following describes every CGI implementation that I'm
>aware of, except for behavior in pathological cases (e.g., the case in
>which 1.3 doesn't even invoke the script) --- in particular, if I read
>the code right, it always describes CERN, and it always describes NCSA
>1.4 and Apache:
>
>   The server maps *prefixes* of URLs onto actual scripts in a
>   server-defined manner.  When a script is invoked, SCRIPT_URI is set
>   to the prefix which caused the server to select that particular
>   script, and the rest of the URL (if any) is available in PATH_INFO....
No (see below).
>   ...The details of this mapping of SCRIPT_URIs to actual scripts are
>   outside the scope of the CGI spec.  However, regardless of the
>   details of the mapping, the following must always be true:
>
>   There is at least one URL which causes the script to be invoked
>   with SCRIPT_URI set to that URL, and PATH_INFO set to the null
>   string.  Appending any string which begins with '/' to any such URL
>   will cause the script to be invoked with the appended string as
>   PATH_INFO.

I already have your second paragraph under 'Server requirements'. Though
I might not have said it as clearly.

>This language makes no reference to the internals of Apache, or NCSA
>1.4.  What's more important any server can implement this
>specification without constraining the way it finds scripts in any
>way, shape or form.

I know. I've already considered this.

>In fact, I can't think of a way to write a CGI script which usefully
>uses PATH_INFO without being able to count on the above-specified
>behavior (again, barring failure to handle pathological cases).

Indeed, which is why I require the server to provide this behaviour.

>
>   And yes, I'd rather be less non-committal, but that's the way
>   things are.
>
>Are they?  What servers do anything different?

Apache, for one.

As you say, there is at least one URL for which PATH_INFO is well defined.
However, that does not require this to be the only URL which can invoke the
script. Thus, given this URL, one can deduce PATH_INFO. But given
PATH_INFO and SCRIPT_NAME, one cannot deduce what the URL was.

Consider:
ScriptAlias /cgi-bin/ /htdocs/cgi-bin/
ScriptAlias /htbin/ /htdocs/cgi-bin/

for a client request of http://host.name/htbin/script/path
SCRIPT_NAME=/cgi-bin/script and PATH_INFO=/path are valid settings (and quite
likely with apache or NCSA httpd). Even the NCSA docs acknowledge this.

Or consider:
/doc.shtml is a server-side include document which does
<!--#exec cgi="/cgi-bin/script" -->

If the client requests http://host.name/doc.shtml/path
then the script is called with SCRIPT_NAME=/cgi-bin/script, PATH_INFO=/path

I do not consider these to be pathalogical cases. In fact, I was told (on this
list) that people rely on the behaviour shown by the second example.
(Much as I deplore it.)

 David.

Mime
View raw message