lib/elasticsearch/transport/client.rb in elasticsearch-transport-7.0.0 vs lib/elasticsearch/transport/client.rb in elasticsearch-transport-7.1.0

- old
+ new

@@ -103,12 +103,12 @@ # (Default: GET) # # @yield [faraday] Access and configure the `Faraday::Connection` instance directly with a block # def initialize(arguments={}, &block) - @options = arguments - @arguments = arguments + @options = arguments.each_with_object({}){ |(k,v), args| args[k.to_sym] = v } + @arguments = @options @arguments[:logger] ||= @arguments[:log] ? DEFAULT_LOGGER.call() : nil @arguments[:tracer] ||= @arguments[:trace] ? DEFAULT_TRACER.call() : nil @arguments[:reload_connections] ||= false @arguments[:retry_on_failure] ||= false @arguments[:reload_on_failure] ||= false @@ -192,10 +192,13 @@ def __parse_host(host) host_parts = case host when String if host =~ /^[a-z]+\:\/\// - uri = URI.parse(host) + # Construct a new `URI::Generic` directly from the array returned by URI::split. + # This avoids `URI::HTTP` and `URI::HTTPS`, which supply default ports. + uri = URI::Generic.new(*URI.split(host)) + { :scheme => uri.scheme, :user => uri.user, :password => uri.password, :host => uri.host, :path => uri.path,