Permalink
Browse files

Cache 2 of Request's commonly called methods.

  • Loading branch information...
1 parent 8fdb34b commit e12e2fb4f660da479110b35b375694bf267aedfb @thedarkone thedarkone committed Sep 27, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 actionpack/lib/action_dispatch/http/url.rb
@@ -15,12 +15,12 @@ def scheme
# 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".

0 comments on commit e12e2fb

Please sign in to comment.