[Web-SIG] WSGI Utils & SCGI/Quixote.

Phillip J. Eby pje at telecommunity.com
Tue Nov 30 20:44:42 CET 2004


At 11:01 AM 11/30/04 -0800, Titus Brown wrote:

>The only real problem in getting this to work was that wsgiServer.py
>expected *every* URL under /demo to be registered to demo_obj.  I
>changed the wsgiServer.py code to allow for partial matches & munged
>the SCRIPT_NAME and PATH_INFO variables appropriately.  I also added
>REQUEST_URI because Quixote uses it for a few things; this should
>probably be moved into QWIP.

I think I'm going to have to call that point out in the PEP 
somewhere.  Technically, the PEP requires that SCRIPT_NAME and PATH_INFO be 
set, but I think perhaps some folks have missed the implications of that 
for the URL path space.

Perhaps something like this would do the trick:

"""
Application Placement in Server URL Space
-----------------------------------------

In order to generate correct SCRIPT_NAME and PATH_INFO variables, servers 
and gateways MUST treat an application's location as a URL path 
prefix.  That is, servers and gateways:

* MUST determine the target application using a matching prefix of the 
request path (which then determines the value of SCRIPT_NAME).

* MUST take the remaining portion of the request path, and use it to 
determine PATH_INFO. (Note that the remainder must be empty or begin with a 
'/', otherwise the prefix match was invalid!)

* MUST assume that there are an infinite number of possible URL paths that 
may appear as a PATH_INFO suffix "beneath" the application's base URL

Notice that these requirements imply that servers and gateways:

* MUST NOT use query string contents, fragment identifiers, or URL 
parameters to determine the application object that a request should be 
sent to.

* MUST NOT require that every URL path used by the application be 
preconfigured or pre-registered with the server, or have some required 
mapping to existing files, or any other requirement that would make dynamic 
URLs impractical.

A server or gateway that cannot meet these requirements IS NOT COMPLIANT 
with this specification; it would be completely unusable for applications 
from many popular Python web frameworks inlcuding at least Zope, Webware, 
and Quixote, and many standalone Python web applications as well.
"""



More information about the Web-SIG mailing list