durusmail: quixote-users: SCRIPT_NAME vs. SCRIPT_URL in get_path()
SCRIPT_NAME vs. SCRIPT_URL in get_path()
2004-09-13
2004-09-13
2004-09-14
SCRIPT_NAME vs. SCRIPT_URL in get_path()
Roman Rodyakin
2004-09-13
I've run into this issue while playing with Quixote forms: the action
URL for a form is defined as request.get_path().  get_path()
essentially returns self.environ['SCRIPT_NAME'] +
self.environ.get('PATH_INFO','').  The problem arises when using a
RewriteRule in Apache for the form's URL.  In this case, the
SCRIPT_NAME variable is set to the substitution specified in the
RewriteRule, and the action_url changes from the one used by the
browser to whatever RewriteRule rewrites it to.  I guess this is not a
problem as long as the form is accessible via both URLs, however I
would like the form to only be accessible via the original URL.

Here is an example to clarify this.  I have the following RewriteRule
in my httpd.conf:

RewriteRule ^/quixote/(.*) /my/complicated/path/$1 [L]

I have Quixote demo's driver script installed under
DocumentRoot/my/complicated/path/demo.fcgi.  In the browser, I type in
http://myserver.com/quixote/demo.fcgi/form_demo, and the action
attribute for the form tag in the quixote-generated HTML is set to
/my/complicated/path/demo.fcgi/form_demo, which is different from the
URL used by the browser to access the form.

Looking at http_request, I see that SCRIPT_NAME is set to
/my/complicated/path/demo.fcgi whereas SCRIPT_URL is set to
/quixote/demo.fcgi/form_demo.

Is this a bug in get_path() or is there a reason why it has to be
SCRIPT_NAME + PATH_INFO, and not SCRIPT_URL?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)

iD8DBQFBRQmCIOXyrI/qnzQRAuYyAJ9dFKkLoU4G3ozL3XW//wMg6+dAXgCfSUq4
YosC61v12C7kgnFcOBgjElE=
=G+7L
-----END PGP SIGNATURE-----
reply