PATH_INFO not populated properly in wildcard

Jun 12, 2010 at 10:41 PM
Edited Jun 12, 2010 at 11:17 PM

Hi.

1. NWSGI = Very cool.

 

2. Need tips understanding what I do wrong with "wildcard" tag in "wsgi" section of web.config.

 

When wildcard tag is NOT used, environ['PATH_INFO'] is populated properly (shows complete unconsumed URI tail). When i use the wildcard, all I get in environ['PATH_INFO'] is scriptname.wsgi with nothing after it.

 

Details:

 

Relevant web.config section:
    <wsgi>
      <wildcard physicalPath="C:\path_here\hello.wsgi" callable="application" />
      <pythonPaths>
        <path path="C:\bin\ironpython\Lib" />
        <path path="C:\bin\ironpython\DLLs" />
        <path path="C:\bin\ironpython" />
        <path path="C:\bin\ironpython\Lib\site-packages" />
      </pythonPaths>
    </wsgi>

 

hello.wsgi:
def application(environ, start_response):
     start_response('200 OK', [('Content-type','text/plain')])
     for key in sorted(environ.keys()):
         yield '%s = %s\n' % (key, unicode(environ[key]).encode('utf8') )

 

the URI (hello.wsgi is in the root of the "site"): 
http://servername//hello.wsgi/asdf/qwre/zxcv.wsgi?key=value

 

Uncommenting the "wildcard" tag and running URI in the browser gives the following (in my oppinion good) settings:
PATH_INFO = /asdf/qwre/zxcv.wsgi
QUERY_STRING = key=value
SCRIPT_NAME = /hello.wsgi

 

With wildcard tag UNcommented (which runs the same exact hello.wsgi), running same URI gives (in my oppinion wrong) settings:

 

PATH_INFO = hello.wsgi
QUERY_STRING = key=value
SCRIPT_NAME = /

 

I tried two version of NWSGI: "nwsgi-2.0.zip" and "nwsgi-2.0-clr4.zip" 

 

My guess is that in wildcard mode I am missing some additional config that makes IIS pass the remaining portion of the matched URI back to the script. Any idea how I can make it work? 

 

 (Windows 7) IIS 7, Integrated mode.  (Errors in Classic mode)
Coordinator
Jun 15, 2010 at 4:51 PM
At first glance, I'd say that there's a bug in NWSGI when constructing the PATH_INFO in wildcard mode. The best option is to use URL rewriting; Microsoft provides a very good URL rewriting module for IIS 7. Wildcard mode is really only intended for use when URL rewriting is not available. However, wildcards should still work properly, so I'll take a look as soon as I get a chance.
Coordinator
Jun 15, 2010 at 4:51 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.