durusmail: quixote-users: Having Quixote serve entire website
Having Quixote serve entire website
2004-05-04
2004-05-04
[PATCH] fix for mod_python Dirtectory/VirtualHost
2004-05-05
Shahms King (2 parts)
Re: [PATCH] fix for mod_python Dirtectory/VirtualHost
2004-05-05
Re: [PATCH] fix for mod_pythonDirtectory/VirtualHost
2004-05-05
2004-05-05
2004-05-05
Having Quixote serve entire website
Shahms King
2004-05-04
On Tue, 2004-05-04 at 08:31, Eric Floehr wrote:
> All,
>
> I am trying to set up mod_python and Quixote to serve my entire website.
> I've got it working now, but the solution is a hack and won't work in the
> general case.  I'm hoping that someone can point me to a more elegant
> solution.
>
> First off, I configured my httpd.conf normally, but instead of the
> mod_python directives residing in a  or  block,
> they exist directly in my  block, like so:
>
> 
>         ...other config settings...
>         SetHandler python-program
>         PythonPath "sys.path + ['/home/eric/lib']"
>         PythonHandler wxbase.mod_python_session_handler
>         PythonOption quixote-root-namespace wxweb
>         PythonOption quixote-config-file /home/eric/public_html/quixote.conf
>         PythonInterpreter wxweb
>         PythonDebug On
> 
>
> When I had the config in a , it worked great.  However,
> moving it to the root caused two problems:
>
> 1. Calls to root, for example "http://www.example.com" were continually
> redirected
> 2. Calls to anything else caused SCRIPT_NAME to equal the first path
> component, with PATH_INFO the rest.  This caused the side-effect that
> expected url "http://www.example.com/example/2004/03" for example, which
> should look up example, call it's _q_lookup with "2004", etc., started
> instead at 2004, which wasn't found, obviously.  So, in order to get it to
> work, you could insert a bogus path component of *anything*, like:
> "http://www.example.com/blabla/example/2004/03" which worked like a charm.
>
> Here is the "hack" I made to get it to work:
>
> In publish.py, line 666 (in v1.0b1), I changed to:
> script_name = request.environ['SCRIPT_NAME']
>     if (not path and script_name <> "/" and fix_trailing_slash):
>
> when requesting the root URL ("http://www.example.com", SCRIPT_NAME is set
> to "/" which caused an infinite redirect.  I don't know enough about
> mod_python and HTTP to know if this is a good fix for the general case or
> not, but it stops the infinite redirect if you have FIX_TRAILING_SLASH to
> 1 (default).
>
> To fix the PATH_INFO/SCRIPT_NAME problem, on line 510 in publish.py I
> changed the "PATH_INFO" variable to "REQUEST_URI".  Now I know this will
> not work in the general sense:
>
> output = self.try_publish(request, env.get('REQUEST_URI', ''))
>
> Is there some change to my mod_python directives that is a better solution?
>
> Thanks for your help!!
>
> Regards,
> Eric

There aren't any directives and the problem impacts  blocks
as well.  The only way using mod_python will work with Quixote at the
moment is to use Location or LocationMatch. From my testing it looks
like the "problem" is that SCRIPT_NAME contains all of the actual
directories in the requested uri plus the one "past the end".  i.e. if
you have a server with DocumentRoot (or ) of:
'/webserver/root' and a directory structure of
'/webserver/root/my/document/directories' a request URI of
'/my/document/directories/somedoc.txt' will have a SCRIPT_NAME of
'/my/document/directories/somedoc.txt' and a PATH_INFO of ''.  I'm doing
a set of (hopefully) exhaustive tests right now to see how to fix this
for all situations and we'll see how that goes.

--
Shahms King 



reply