Class: ActionDispatch::Routing::RouteSet
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::RouteSet
- Defined in:
- lib/url_for.rb
Instance Method Summary collapse
-
#url_for_with_non_ssl_host(options) ⇒ Object
if full URL is requested for http and we’ve been told to use a non-ssl host override, then use it.
-
#url_for_with_secure_option(options = {}) ⇒ Object
Add a secure option to the rewrite method.
Instance Method Details
#url_for_with_non_ssl_host(options) ⇒ Object
if full URL is requested for http and we’ve been told to use a non-ssl host override, then use it
38 39 40 41 42 43 44 45 |
# File 'lib/url_for.rb', line 38 def url_for_with_non_ssl_host() if ![:only_path] && !SslRequirement.non_ssl_host.nil? if !(/^https/ =~ ([:protocol] || @request.try(:protocol))) .merge! :host => SslRequirement.non_ssl_host end end url_for_without_non_ssl_host() end |
#url_for_with_secure_option(options = {}) ⇒ Object
Add a secure option to the rewrite method.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/url_for.rb', line 9 def url_for_with_secure_option( = {}) secure = .delete(:secure) # if secure && ssl check is not disabled, convert to full url with https if !secure.nil? && !SslRequirement.disable_ssl_check? if secure == true || secure == 1 || secure.to_s.downcase == "true" .merge!({ :only_path => false, :protocol => 'https' }) # if we've been told to use different host for ssl, use it unless SslRequirement.ssl_host.nil? .merge! :host => SslRequirement.ssl_host end # make it non-ssl and use specified options else .merge!({ :protocol => 'http' }) end end url_for_without_secure_option() end |