aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/url.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2010-08-19 15:29:54 +0100
committerJosé Valim <jose.valim@gmail.com>2010-08-20 10:40:34 -0300
commit0d0fbf1e648606c9499e332bad412da005a4e37f (patch)
treec6448eaf8d844c27b102b11009172784767d4588 /actionpack/lib/action_dispatch/http/url.rb
parent771d2f918fc87bdd4f83e6666fd816e9f0dcedfb (diff)
downloadrails-0d0fbf1e648606c9499e332bad412da005a4e37f.tar.gz
rails-0d0fbf1e648606c9499e332bad412da005a4e37f.tar.bz2
rails-0d0fbf1e648606c9499e332bad412da005a4e37f.zip
Don't add the standard https port when using redirect in routes.rb and ensure that request.scheme returns https when using a reverse proxy.
[#5408 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_dispatch/http/url.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index b64a83c62e..ffb7bdd586 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -6,6 +6,11 @@ module ActionDispatch
protocol + host_with_port + fullpath
end
+ # Returns 'https' if this is an SSL request and 'http' otherwise.
+ def scheme
+ ssl? ? 'https' : 'http'
+ end
+
# Returns 'https://' if this is an SSL request and 'http://' otherwise.
def protocol
ssl? ? 'https://' : 'http://'
@@ -53,6 +58,11 @@ module ActionDispatch
end
end
+ # Returns whether this request is using the standard port
+ def standard_port?
+ port == standard_port
+ end
+
# Returns a \port suffix like ":8080" if the \port number of this request
# is not the default HTTP \port 80 or HTTPS \port 443.
def port_string