Opened 13 years ago
Closed 12 years ago
#17550 closed Bug (fixed)
WSGI request to /subdir/subdir returns the index page
Reported by: | Diederik van der Boor | Owned by: | Aymeric Augustin |
---|---|---|---|
Component: | Core (URLs) | Version: | 1.4-alpha-1 |
Severity: | Normal | Keywords: | |
Cc: | Grzegorz Szczepańczyk, Rafał Jagoda | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When hosting a Django folder in a subdirectory, using:
WSGIScriptAlias /foo/bar /path/to/wsgi.py
Then the index page is also available at /foo/bar/foo/bar
(repeated script prefix, without a slash).
When stepping through the Django code, this seems to be caused by the following line in the WSGIRequest.__init__()
method:
if not path_info or path_info == script_name:
Attachments (1)
Change History (9)
comment:2 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
As explained in the source, this condition is a workaround for a bug in flup, reported in #8490 and fixed at r8569. I don't know if that bug was reported to flup.
flup 1.0.2 was released 2.5 years ago, if it fixes the bug, maybe we can get rid of this hack...
by , 13 years ago
Attachment: | 17550.diff added |
---|
comment:3 by , 13 years ago
Cc: | added |
---|---|
Has patch: | set |
Triage Stage: | Accepted → Unreviewed |
Flup 1.0.1 has wrong interpretation of path_info for /foo/bar uri - it's set to /foo/bar instead of . It's equal to script_name, but's true while uri == /foo/bar/foo/bar in other cases.
This patch should fix problem with current and old bug.
Tested on apache mod_wsgi, flup 1.0.1 and 1.0.3.dev.
comment:4 by , 13 years ago
Cc: | added |
---|---|
Triage Stage: | Unreviewed → Ready for checkin |
comment:5 by , 12 years ago
Triage Stage: | Ready for checkin → Design decision needed |
---|
Do we really want to maintain and extend hacks in Django, just to support buggy and abandoned third party software?
flup's tracker is broken. The last release dates back to 3.5 years ago.
Unless the maintainers of flup commit to fixing their bugs within a decent timeframe (ie. 6 months), my vote is to revert r8569.
comment:6 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I'll ask Malcolm for permission to revert r8569 next time I meet him.
comment:7 by , 12 years ago
Triage Stage: | Design decision needed → Accepted |
---|
comment:8 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Amending, the result of that sets
request.path_info = u'/'
theirby producing an inconsistent state:request.META['REQUEST_URI']
= /foo/bar/foo/bar?querystringrequest.path
= /foo/bar/request.path_info
= /Where both
path
andpath_info
should have been prefixed with another/foo/bar
from the request.