Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #7603 -- Added a 'scheme' property to the HttpRequest object #1730

Closed
wants to merge 1 commit into from
Closed

Fixed #7603 -- Added a 'scheme' property to the HttpRequest object #1730

wants to merge 1 commit into from

Conversation

umazalakain
Copy link

HttpRequest.scheme uses self.is_secure() to determine if scheme is
'http' or 'https' wether WSGIRequest.scheme makes use of the
'wsgi.url_scheme' WSGI environ variable.

This provides a handful method to check for current scheme in, for
example, templates. It also allows to deal with other schemes.

@timgraham
Copy link
Member

Although the tests are passing, I think this patch is problematic in that request.scheme bypasses settings.SECURE_PROXY_SSL_HEADER which is part of the request.is_secure() method.

`HttpRequest.scheme` is `https` if `settings.SECURE_PROXY_SSL_HEADER`
appropriately set, falls back to `HttpRequest._get_scheme()` (a hook for
subclasses to implement) otherwise.

`WSGIRequest._get_scheme()` makes use of `wsgi.url_scheme` WSGI environ variable
to determine the request scheme.

`HttpRequest.is_secure()` not simply checks if `HttpRequest.scheme` is `https`.

This provides a handful method to check for current scheme in, for
example, templates. It also allows to deal with other schemes.
@umazalakain
Copy link
Author

Please @timgraham check the new commit.

@timgraham
Copy link
Member

merged in c7634cd - thanks!

one note: I found some trailing whitespace in your patch that I removed. You may want to configure your editor to remove that if possible.

@timgraham timgraham closed this Oct 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants