summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-10-20 12:34:50 +0200
committerClaude Paroz <claude@2xlibre.net>2012-10-20 13:55:13 +0200
commit681550ca6d5ff3e591a769643e37fd0b50f29c91 (patch)
tree66dfb22aab1ebe0868d45f22a1913d457d1b6cfb /django
parent3084b1cfd6110e2ef57f1a67f8b7dbda309e2e13 (diff)
Removed custom WSGIRequestHandler.get_environ
We probably historically customized it for good reasons, but currently, the differences with upstream Python are not significant any longer. Also fixes #19075 for which a test has been added.
Diffstat (limited to 'django')
-rw-r--r--django/core/servers/basehttp.py34
1 files changed, 1 insertions, 33 deletions
diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py
index 19b287af87..a7004f2c2f 100644
--- a/django/core/servers/basehttp.py
+++ b/django/core/servers/basehttp.py
@@ -14,9 +14,8 @@ import socket
import sys
import traceback
try:
- from urllib.parse import unquote, urljoin
+ from urllib.parse import urljoin
except ImportError: # Python 2
- from urllib import unquote
from urlparse import urljoin
from django.utils.six.moves import socketserver
from wsgiref import simple_server
@@ -139,37 +138,6 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler, object):
self.style = color_style()
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
- def get_environ(self):
- env = self.server.base_environ.copy()
- env['SERVER_PROTOCOL'] = self.request_version
- env['REQUEST_METHOD'] = self.command
- if '?' in self.path:
- path,query = self.path.split('?',1)
- else:
- path,query = self.path,''
-
- env['PATH_INFO'] = unquote(path)
- env['QUERY_STRING'] = query
- env['REMOTE_ADDR'] = self.client_address[0]
- env['CONTENT_TYPE'] = self.headers.get('content-type', 'text/plain')
-
- length = self.headers.get('content-length')
- if length:
- env['CONTENT_LENGTH'] = length
-
- for key, value in self.headers.items():
- key = key.replace('-','_').upper()
- value = value.strip()
- if key in env:
- # Skip content length, type, etc.
- continue
- if 'HTTP_' + key in env:
- # Comma-separate multiple headers
- env['HTTP_' + key] += ',' + value
- else:
- env['HTTP_' + key] = value
- return env
-
def log_message(self, format, *args):
# Don't bother logging requests for admin images or the favicon.
if (self.path.startswith(self.admin_static_prefix)