summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-06-13 10:11:41 +0200
committerAndrew Godwin <andrew@aeracode.org>2019-06-15 10:29:02 -0700
commit415e899dc46c2f8d667ff11d3e54eff759eaded4 (patch)
tree0f2db2cb4c2bebcab6fb12b594b8a3394112b714 /django/core
parent87f5d07eededc86f8ce1797fdfca7d4903ee0edc (diff)
Refs #30451 -- Added HttpRequest._set_content_type_params() hook.
Diffstat (limited to 'django/core')
-rw-r--r--django/core/handlers/wsgi.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py
index 47b008a004..1bca717304 100644
--- a/django/core/handlers/wsgi.py
+++ b/django/core/handlers/wsgi.py
@@ -1,5 +1,3 @@
-import cgi
-import codecs
import re
from io import BytesIO
@@ -80,14 +78,8 @@ class WSGIRequest(HttpRequest):
self.META['PATH_INFO'] = path_info
self.META['SCRIPT_NAME'] = script_name
self.method = environ['REQUEST_METHOD'].upper()
- self.content_type, self.content_params = cgi.parse_header(environ.get('CONTENT_TYPE', ''))
- if 'charset' in self.content_params:
- try:
- codecs.lookup(self.content_params['charset'])
- except LookupError:
- pass
- else:
- self.encoding = self.content_params['charset']
+ # Set content_type, content_params, and encoding.
+ self._set_content_type_params(environ)
try:
content_length = int(environ.get('CONTENT_LENGTH'))
except (ValueError, TypeError):