[mod_python] missing path element in path_info

Gregory (Grisha) Trubetskoy grisha at modpython.org
Wed Jul 9 13:10:30 EST 2003


I am not sure I understand the difference between the first two, the
request seems to be the same. What are the url's that you're trying to
access (from the browser point of view)?

In the last one, the reason "1" is not part of path_info: path_info is
something apache figures out. I think the rule is that it sees that "test"
is a directory, and the next thing after it isn't, thus, it must refer to
a file (whether or not the file exists doesn't matter). Everything after a
file is path_info.

On Wed, 9 Jul 2003, Matt Goodall wrote:

> Hi,
>
> Over in the world of Albatross
> (http://www.object-craft.com.au/projects/albatross/) we've been playing
> with path_info and have come across something that we don't quite
> understand.
>
> Here's some example code to demonstrate:
>
> ----- .htaccess -----
> DirectoryIndex app.py
> SetHandler python-program
> PythonHandler app
> -----
>
> ----- app.py -----
> from mod_python import apache
>                                                                                 def handler(req):
>     req.content_type = 'text/plain'
>     req.send_http_header()
>
>     req.write('the_request: %s\n' % req.the_request)
>     req.write('unparsed_uri: %s\n' % req.unparsed_uri)
>     req.write('uri: %s\n' % req.uri)
>     req.write('filename: %s\n' % req.filename)
>     req.write('path_info: %s\n' % req.path_info)
>
>     return apache.OK
> -----
>
> If I put those files in /~matt/test on the web server then this is what
> I see for each URL:
>
>         = URL /~matt/test/1/2/3 =
>         the_request: GET /~matt/test/app.py/1/2/3 HTTP/1.1
>         unparsed_uri: /~matt/test/app.py/1/2/3
>         uri: /~matt/test/app.py/1/2/3
>         filename: /home/matt/public_html/test/app.py
>         path_info: /1/2/3
>
>         = /~matt/test/app.py/1/2/3 =
>         the_request: GET /~matt/test/app.py/1/2/3 HTTP/1.1
>         unparsed_uri: /~matt/test/app.py/1/2/3
>         uri: /~matt/test/app.py/1/2/3
>         filename: /home/matt/public_html/test/app.py
>         path_info: /1/2/3
>
>         = /~matt/test/1/2/3 =
>         the_request: GET /~matt/test/1/2/3 HTTP/1.1
>         unparsed_uri: /~matt/test/1/2/3
>         uri: /~matt/test/1/2/3
>         filename: /home/matt/public_html/test/1
>         path_info: /2/3
>
> The first two are as expected but the last one drops app.py completely
> and thinks that the first element of path_info is part of the filename.
>
> Can anyone explain this?
>
> Server details:
>
> 	Apache 1.3.27
> 	mod_python 2.7.8
> 	Linux 2.4.x, Gentoo and Debian (I think).
>
> Thanks in advance.
>
> - Matt
>
> --
> Matt Goodall, Pollenation Internet Ltd
> w: http://www.pollenation.net
> e: matt at pollenation.net
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list