Question about SCRIPT_NAME and PATH_INFO parsing

73 views
Skip to first unread message

Andrew Stromnov

unread,
May 28, 2009, 8:40:44 AM5/28/09
to Fast Asynchronous Python Web Server
I have single WSGI application. When running it under wsgiref,
cherrypy, eventlet and cogen implementations, then such urls as
'http://localhost:8080/v1/activate' parsed to:
environ["SCRIPT_NAME"] = ""
environ["PATH_INFO"] = "/v1/activate"

Why fapws3 parse this url to:
environ["SCRIPT_NAME"] = "/"
environ["PATH_INFO"] = "v1/activate"
environ["fapws.uri"] = "/v1/activate"
?

Definitions from PEP-0333:

SCRIPT_NAME
The initial portion of the request URL's "path" that corresponds
to the application object, so that the application knows its virtual
"location". This may be an empty string, if the application
corresponds to the "root" of the server.

PATH_INFO
The remainder of the request URL's "path", designating the virtual
"location" of the request's target within the application. This may be
an empty string, if the request URL targets the application root and
does not have a trailing slash.

william opensource4you

unread,
May 28, 2009, 2:12:43 PM5/28/09
to fa...@googlegroups.com
This depends how you register your scripts.
here, most probably you have registered a script "/" ==> Script_name is "/".

You could have the same by registring "", but that way it will always
match. This is like a generic callback.

Hope this help you.

Reply all
Reply to author
Forward
0 new messages