Code

Opened 2 years ago

Closed 13 months ago

#17550 closed Bug (fixed)

WSGI request to /subdir/subdir returns the index page

Reported by: vdboor Owned by: aaugustin
Component: Core (URLs) Version: 1.4-alpha-1
Severity: Normal Keywords:
Cc: gszczepanczyk, rafallo 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)

17550.diff (853 bytes) - added by gszczepanczyk 2 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 2 years ago by vdboor

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Amending, the result of that sets request.path_info = u'/' theirby producing an inconsistent state:

  • request.META['REQUEST_URI'] = /foo/bar/foo/bar?querystring
  • request.path = /foo/bar/
  • request.path_info = /

Where both path and path_info should have been prefixed with another /foo/bar from the request.

Last edited 2 years ago by vdboor (previous) (diff)

comment:2 Changed 2 years ago by aaugustin

  • Triage Stage changed from Unreviewed to 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...

Changed 2 years ago by gszczepanczyk

comment:3 Changed 2 years ago by gszczepanczyk

  • Cc gszczepanczyk added
  • Has patch set
  • Triage Stage changed from Accepted to 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 Changed 2 years ago by rafallo

  • Cc rafallo added
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:5 Changed 16 months ago by aaugustin

  • Triage Stage changed from Ready for checkin to 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 Changed 13 months ago by aaugustin

  • Owner changed from nobody to aaugustin
  • Status changed from new to assigned

I'll ask Malcolm for permission to revert r8569 next time I meet him.

comment:7 Changed 13 months ago by aaugustin

  • Triage Stage changed from Design decision needed to Accepted

comment:8 Changed 13 months ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In f5dbb566ee07bf3328015c70574b832052b4ebb7:

Fixed #17550 -- Removed a workaround for a bug in flup 1.0.1.

This reverts commit 948a833eb7fd9be0bc2d585c92a407f036ef42b2.

flup appears to be dead, and this fix breaks legitimate uses of Django.

Refs #8490.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.