summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorUnai Zalakain <unai@gisa-elkartea.org>2013-10-08 20:30:29 +0200
committerTim Graham <timograham@gmail.com>2013-10-15 09:04:12 -0400
commitc7634cd7fe7dc09338fcec0ca48d816a29d791b0 (patch)
treee7e2d0d4c17dcaa6ed8eaf3f61741409ea988aae /docs/ref
parent9bfe66164e0e214abc6063a1a60ce729094d0632 (diff)
Fixed #7603 -- Added a 'scheme' property to the HttpRequest object
`HttpRequest.scheme` is `https` if `settings.SECURE_PROXY_SSL_HEADER` is appropriately set and falls back to `HttpRequest._get_scheme()` (a hook for subclasses to implement) otherwise. `WSGIRequest._get_scheme()` makes use of the `wsgi.url_scheme` WSGI environ variable to determine the request scheme. `HttpRequest.is_secure()` simply checks if `HttpRequest.scheme` is `https`. This provides a way to check the current scheme in templates, for example. It also allows us to deal with other schemes. Thanks nslater for the suggestion.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/request-response.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index a4ed6a2645..57222c8ca7 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -32,6 +32,13 @@ Attributes
All attributes should be considered read-only, unless stated otherwise below.
``session`` is a notable exception.
+.. attribute:: HttpRequest.scheme
+
+ .. versionadded:: 1.7
+
+ A string representing the scheme of the request (``http`` or ``https``
+ usually).
+
.. attribute:: HttpRequest.body
The raw HTTP request body as a byte string. This is useful for processing