aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-05-20 15:20:16 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-05-20 15:20:16 -0700
commit6004c753fed39402fbb014c33a51694d555123de (patch)
tree45c1564791374ea40e026d9e2fbabf35cf12b10b /actionpack/lib/action_dispatch
parent5e181ed0aeb829510f1c739a7dcc8328d2675258 (diff)
downloadrails-6004c753fed39402fbb014c33a51694d555123de.tar.gz
rails-6004c753fed39402fbb014c33a51694d555123de.tar.bz2
rails-6004c753fed39402fbb014c33a51694d555123de.zip
fewer method calls and string garbage when there is no user/password
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index c9860af909..ffba0a82d2 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -79,7 +79,11 @@ module ActionDispatch
options[:port] = normalize_port(options)
result << options[:protocol]
- result << rewrite_authentication(options)
+
+ if options[:user] && options[:password]
+ result << "#{Rack::Utils.escape(options[:user])}:#{Rack::Utils.escape(options[:password])}@"
+ end
+
result << options[:host]
result << ":#{options[:port]}" if options[:port]
end
@@ -94,14 +98,6 @@ module ActionDispatch
(options[:subdomain] == true || !options.key?(:subdomain)) && options[:domain].nil?
end
- def rewrite_authentication(options)
- if options[:user] && options[:password]
- "#{Rack::Utils.escape(options[:user])}:#{Rack::Utils.escape(options[:password])}@"
- else
- ""
- end
- end
-
def normalize_protocol(options)
case options[:protocol]
when nil