aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthedarkone <thedarkone2@gmail.com>2010-09-27 17:37:40 +0200
committerthedarkone <thedarkone2@gmail.com>2010-09-27 17:45:59 +0200
commite12e2fb4f660da479110b35b375694bf267aedfb (patch)
tree2d8ece51ec724f8720b9fe4c7d517a9be368fd9f
parent8fdb34b2373b13eee24a403a3af398cddb2a5ad0 (diff)
downloadrails-e12e2fb4f660da479110b35b375694bf267aedfb.tar.gz
rails-e12e2fb4f660da479110b35b375694bf267aedfb.tar.bz2
rails-e12e2fb4f660da479110b35b375694bf267aedfb.zip
Cache 2 of Request's commonly called methods.
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index 2e39d0dbc2..3e5cd6a2f9 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -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".