mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Cache 2 of Request's commonly called methods.
This commit is contained in:
parent
8fdb34b237
commit
e12e2fb4f6
1 changed files with 2 additions and 2 deletions
|
@ -15,12 +15,12 @@ module ActionDispatch
|
|||
|
||||
# Returns 'https://' if this is an SSL request and 'http://' otherwise.
|
||||
def protocol
|
||||
ssl? ? 'https://' : 'http://'
|
||||
@protocol ||= ssl? ? 'https://' : 'http://'
|
||||
end
|
||||
|
||||
# Is this an SSL request?
|
||||
def ssl?
|
||||
@env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == 'https'
|
||||
@ssl ||= @env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == 'https'
|
||||
end
|
||||
|
||||
# Returns the \host for this request, such as "example.com".
|
||||
|
|
Loading…
Reference in a new issue