﻿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
17133	get_script_name goofs when there is Apache URL rewriting	gjanee@…	nobody	"When running under Apache+mod_wsgi (I'm not sure the mod_wsgi is relevant here), using a WSGIScriptAlias of `/foo`, a request for URL `/foo/bar//baz` (note double slash) gets transformed by Apache to `/foo/bar/baz` and then by Django to `/foo//bar/baz` (note where double slashes are now).  Furthermore, a callback function for urlpattern `""^bar/.*""` will be called on this latter path even though it doesn't match the pattern.  That is, request.path will be `/foo//bar/baz`, which can be confusing for a callback function that is expecting request.path to match the WSGIScriptAlias plus the urlpattern.

I don't totally understand what Django is doing here, but I believe the problem is in django.core.handlers.base.get_script_name.  In that function, to get the script name in this situation Django starts with the environment variable SCRIPT_URL, and strips off a number of characters at the end equal to the length of environment variable PATH_INFO.  Because in this case Apache collapses the double slash in `/foo/bar//baz` to `/foo/bar/baz`, get_script_name strips off one less character than necessary, so that instead of the script name being `/foo` it is `/foo/`.  This may account for the double slash appearing `/foo`, as in `/foo//bar/baz`."	Cleanup/optimization	closed	HTTP handling	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
