lib/amq/uri.rb in amq-protocol-1.9.2 vs lib/amq/uri.rb in amq-protocol-2.0.0

- old
+ new

@@ -1,9 +1,7 @@ # encoding: utf-8 -require "amq/settings" - require "cgi" require "uri" module AMQ class URI @@ -16,17 +14,17 @@ raise ArgumentError.new("Connection URI must use amqp or amqps schema (example: amqp://bus.megacorp.internal:5766), learn more at http://bit.ly/ks8MXK") unless %w{amqp amqps}.include?(uri.scheme) opts = {} opts[:scheme] = uri.scheme - opts[:user] = ::URI.unescape(uri.user) if uri.user - opts[:pass] = ::URI.unescape(uri.password) if uri.password + opts[:user] = ::CGI::unescape(uri.user) if uri.user + opts[:pass] = ::CGI::unescape(uri.password) if uri.password opts[:host] = uri.host if uri.host opts[:port] = uri.port || AMQP_PORTS[uri.scheme] opts[:ssl] = uri.scheme.to_s.downcase =~ /amqps/i if uri.path =~ %r{^/(.*)} raise ArgumentError.new("#{uri} has multiple-segment path; please percent-encode any slashes in the vhost name (e.g. /production => %2Fproduction). Learn more at http://bit.ly/amqp-gem-and-connection-uris") if $1.index('/') - opts[:vhost] = ::URI.unescape($1) + opts[:vhost] = ::CGI::unescape($1) end opts end def self.parse_amqp_url(s)