mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
Fixed #7871 -- Added some more bullet-proofing in PATH_INFO determination,
since Django would like it to at least contain a '/' (rather than being an empty string). git-svn-id: http://code.djangoproject.com/svn/django/trunk@8032 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -76,7 +76,13 @@ def safe_copyfileobj(fsrc, fdst, length=16*1024, size=0):
|
||||
class WSGIRequest(http.HttpRequest):
|
||||
def __init__(self, environ):
|
||||
script_name = base.get_script_name(environ)
|
||||
path_info = force_unicode(environ.get('PATH_INFO', '/'))
|
||||
path_info = force_unicode(environ.get('PATH_INFO', u'/'))
|
||||
if not path_info:
|
||||
# Sometimes PATH_INFO exists, but is empty (e.g. accessing
|
||||
# the SCRIPT_NAME URL without a trailing slash). We really need to
|
||||
# operate as if they'd requested '/'. Not amazingly nice to force
|
||||
# the path like this, but should be harmless.
|
||||
path_info = u'/'
|
||||
self.environ = environ
|
||||
self.path_info = path_info
|
||||
self.path = '%s%s' % (script_name, path_info)
|
||||
|
||||
Reference in New Issue
Block a user