httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James H. Cloos Jr." <cl...@jhcloos.com>
Subject Re: mod_actions weirdness
Date Sun, 28 Mar 1999 05:15:15 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "Charles" == Charles Sliger <chaz@reliant.com> 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)

Exactly.

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 www.io.com:80, 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.

Yup.

Charles> 1. <http://www.io.com/~cloos/action/.htaccess>
Charles> 2. <http://www.io.com/~cloos/action/index.html>
Charles> 3. <http://www.io.com/~cloos/printenv.cgi/~cloos/action/index.html>
Charles> 4. <http://www.io.com/~cloos/printenv.cgi>

- -JimC
- -- 
James H. Cloos, Jr.  <http://www.jhcloos.com/cloos/public_key> 1024D/ED7DAEA6 
<cloos@jhcloos.com>     E9E9 F828 61A4 6EA9 0F2B  63E7 997A 9F17 ED7D AEA6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v0.9.5 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE2/brimXqfF+19rqYRAj06AJ4sz1041kpjDcHPM/mJUBMpyq7fpACgmSf1
uMXqYL+w3ypmN4xBwyG3Gjc=
=J+Af
-----END PGP SIGNATURE-----

Mime
View raw message