summaryrefslogtreecommitdiff
path: root/django/views/debug.py
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2021-04-29 14:35:11 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-04-30 08:05:42 +0200
commit8bcb00858e0ddec79cc96669c238d29c30d7effb (patch)
treecba5b4df1cd188543adc523ccedfead1ac26075d /django/views/debug.py
parentca34db46504fca1221e27f6ab13734dfdfde6e1c (diff)
Fixed #32698 -- Moved HttpRequest.get_raw_uri() to ExceptionReporter._get_raw_insecure_uri().
Diffstat (limited to 'django/views/debug.py')
-rw-r--r--django/views/debug.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/django/views/debug.py b/django/views/debug.py
index 67bb5de20b..16c9ad7fc8 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -274,6 +274,17 @@ class ExceptionReporter:
self.template_does_not_exist = False
self.postmortem = None
+ def _get_raw_insecure_uri(self):
+ """
+ Return an absolute URI from variables available in this request. Skip
+ allowed hosts protection, so may return insecure URI.
+ """
+ return '{scheme}://{host}{path}'.format(
+ scheme=self.request.scheme,
+ host=self.request._get_raw_host(),
+ path=self.request.get_full_path(),
+ )
+
def get_traceback_data(self):
"""Return a dictionary containing traceback information."""
if self.exc_type and issubclass(self.exc_type, TemplateDoesNotExist):
@@ -337,6 +348,8 @@ class ExceptionReporter:
c['request_GET_items'] = self.request.GET.items()
c['request_FILES_items'] = self.request.FILES.items()
c['request_COOKIES_items'] = self.request.COOKIES.items()
+ c['request_insecure_uri'] = self._get_raw_insecure_uri()
+
# Check whether exception info is available
if self.exc_type:
c['exception_type'] = self.exc_type.__name__