httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James H. Cloos Jr." <>
Subject Re: mod_actions weirdness
Date Sun, 28 Mar 1999 05:15:15 GMT
Hash: SHA1

>>>>> "Charles" == Charles Sliger <> writes:

Charles> 1. simply returns the .htaccess file containing the
Charles> 'Action' directive:
Charles> Action text/html /~cloos/printenv.cgi

Yes.  I mentioned it so that you could see what a functioning
directive looks like in practice.

Charles> 2. When I access the URL in #2, I get an evironment
Charles> dump.  I presume that the script 'printenv.cgi'
Charles> has been executed as a result of the fact that a
Charles> text/html page has been requested. (index.html)


Charles> It doesn't seem to be appending the document to the
Charles> script path.
Charles> On the Sequent system I am testing, I get an error
Charles> saying that /.../script.cgi/mypage.html can't be found.

It is appending the string "/~cloos/action/index.html" to the URL path
specified in the Action directive, resulting in the string
"/~cloos/printenv.cgi/~cloos/action/index.html" and then doing an
internal redirect to that URL.  This runs the CGI.

Charles> 3. This line looks really strange to me...
Charles> I'm surprised that it constitutes a valid path.
Charles> Does the 2nd '~' negate what came before it and
Charles> cause the path to restart at your home dir?
Charles> Or is everything from the 2nd '~' to the end of the
Charles> line passed to the script as an argument?

Any string which starts with a `/' and follows a CGI page (or a page
interpreted by any scripting module, such as mod_include, php, etc)
will be interpreted as though the path to the CGI were left out of the
URL.  Ie, when you request:

        GET /~cloos/printenv.cgi/~cloos/action/index.html HTTP/1.0

from, apache will look at what file would be sent were
the request instead:

        GET /~cloos/action/index.html HTTP/1.0

and use that filename as the PATH_TRANSLATED value.  It goes through
all the modules to find that file, including mod_userdir, thereby
allowing /~cloos/ to work.  You can see from the environmental dumps
in 2 and 3 below that SCRIPT_FILENAME and PATH_TRANSLATED are physical
paths on the filesystem; paths that the CGI can use to find the
requested file should it want to read it in.  OTOH SCRIPT_URL,
SCRIPT_NAME, PATH_INFO, and REQUEST_URI are all URLs relative to
(using /bin/sh syntax) http://$(HTTP_HOST):$(SERVER_PORT)/, and
SCRIPT_URI is a fully absolute URL.

I'm sure there a docs out there that better describe this.  It is a
long-standing apache feature.

Charles> 4. This line I understand.  It just runs the cgi script
Charles> directly.


Charles> 1. <>
Charles> 2. <>
Charles> 3. <>
Charles> 4. <>

- -JimC
- -- 
James H. Cloos, Jr.  <> 1024D/ED7DAEA6 
<>     E9E9 F828 61A4 6EA9 0F2B  63E7 997A 9F17 ED7D AEA6
Version: GnuPG v0.9.5 (GNU/Linux)
Comment: For info see


View raw message