#24463: Remove old functionality from `HttpRequest`
--------------------------------------+--------------------
     Reporter:  rednaw                |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  HTTP handling         |    Version:  master
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 The `scheme()` method on `HttpRequest` returns the scheme the request was
 on, so http or https. If you look at the implementation of the method:

 https://github.com/django/django/blob/master/django/http/request.py#L163

 You see that it checks a Django setting and if that doesn't result in
 https, it falls back to the `_get_scheme()` method.

 Now if you look at the `_get_scheme()` method:

 https://github.com/django/django/blob/master/django/http/request.py#L159

 You see it checks if the environment variable "HTTPS" is set to "on". I
 think is old functionality that doesn't belong in Django anymore. It was
 probably from the time mod_python was used. These days this functionality
 is implemented by WSGI:

 https://www.python.org/dev/peps/pep-3333/#environ-variables

 (search for HTTPS=on)

 Also the WSGI handler in Django overwrites the `_get_scheme()`:

 https://github.com/django/django/blob/master/django/core/handlers/wsgi.py#L115

 And since every HTTP request in Django goes through WSGI, the
 `_get_scheme()` method in `HttpRequest` would never be used.

 So I think we should remove this functionality from `HttpRequest`, to
 prevent confusion, because when I stumbled upon this piece of code it
 confused me quite a bit and it took me some time to find out what it might
 be.

--
Ticket URL: <https://code.djangoproject.com/ticket/24463>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.c3f5aa60696a6317e66e44e7314ba09b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to