﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23173	SCRIPT_URL on WSGI is misinterpreted when PATH_INFO is empty	j-sz@…	Bas Peschier	"This bug is pretty obvious. In the dev version it's in django/core/handlers/wsgi.py:235 in get_script_name; in 1.5.1 (where I've found it) it's in django/core/handlers/base.py:280. I haven't checked how long it's been there.

The problem is due to slicing with a negative end index:
{{{
script_name = script_url[:-len(path_info)]
}}}
It works fine as long as path_info is not empty. On my system it was empty and the whole script_url was truncated.

I've grepped the source tree for `'\[:-[^0-9]'` to check if there are some other instances of this pattern and it returned a couple of results. I'd suggest examining them and making sure the indices are non-zero.

A patch would be trivial, but I'm not giving it, because I feel that a general function 'chop off n elements from the end' might be handy and I'm not sure where to put it."	Bug	closed	Core (URLs)	dev	Normal	fixed	wsgi, script name, negative index slicing,ams2015		Ready for checkin	1	0	0	0	0	0
