Hello,
while debugging a Django site recently, I came across surprising behavior related to WSGI handling. In django/core/handlers/wsgi.py (current git head), the get_script_name function contains the following fragment:
if script_url:
path_info = get_bytes_from_wsgi(environ, 'PATH_INFO', '')
script_name = script_url[:-len(path_info)]
This should remove whatever path fragment was appended to script name when that is retrieved from SCRIPT_URL rather than SCRIPT_NAME, but the code does not handle the special case where PATH_INFO is empty (which it can be according to comments in PEP 333). In that case, script name is set to an empty string, rather than being left as it is (as it should be).
Is it possible that this is a bug, or am I looking at things wrong ?
Thanks, Petr