[Web-SIG] Who is responsible for SCRIPT_NAME?

Robert Brewer fumanchu at amor.org
Tue Feb 7 08:12:07 CET 2006


Ian Bicking said:
> The HTTP server should always set SCRIPT_NAME to ''.

Christian asked:
> If it is a full blown WSGI compliant HTTP server,
> why should it do that? Shouldn't it support mounting
> applications at various points (SCRIPT_NAME locations)?

and Ian replied:
> It doesn't really need to do that, it's easy to do
> that in the WSGI application itself.  For instance:
> 
> def dispatch(app_map):
>     ...
> 
> I can understand this is a common desire and it
> is not obvious that you can do this, so it might
> be useful to include some middleware like this.
> But the server itself does not need to do this.
> And there's lots of ways you might want to do
> this (e.g., virtual hosts, which do the same
> basic thing but match against environ['HTTP_HOST']).
> Paste includes code along these lines in paste.urlmap

Aargh. This is getting really confusing for me as the author of WSGI gateways (wrappers around non-WSGI HTTP servers, like mod_python + Apache), one of the maintainers of a pure WSGI HTTP server (in CherryPy) and the primary developer of a WSGI interface for a popular app framework (CherryPy). On the one hand, I'm being told that WSGI apps need to "obey" SCRIPT_NAME no matter where it comes from, and on the other, I'm being told that SCRIPT_NAME is essentially ignorable. I'm getting tired of the run-around.

Dear Web-SIG, please weigh in. Who is responsible for SCRIPT_NAME (setting and/or interpreting it) and what does it "mean"? I've been told that PEP 333 requires that the origin server (like my modpython_gateway, for example) must be told the "mount point" of every WSGI app it serves and set SCRIPT_NAME to that, always, so the app can trust it. Now (by the same person, as far as I can tell) I'm being told that the origin server should always set SCRIPT_NAME to "", which IMO denies the reason for its inclusion in the spec. Regardless of the answer, that answer needs to be more clear in the spec--even if the answer is "it depends" or "do what you want". So please, let's decide so I can make compliant all the code for which I'm responsible. I'm so very tired of interpretation games. Ian and I keep talking past each other, so I, at least, need others to chime in and explain things.


Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/web-sig/attachments/20060206/98503780/attachment.html 


More information about the Web-SIG mailing list