lib/riak/client/excon_backend.rb in riak-client-1.1.1 vs lib/riak/client/excon_backend.rb in riak-client-1.2.0

- old
+ new

@@ -148,15 +148,25 @@ raise HTTPFailedRequest.new(method, expect, response.status, response_headers.to_hash, response.body) end end def connection - @connection ||= Excon::Connection.new( - root_uri.to_s, - :read_timeout => self.class.read_timeout, + @connection ||= new_connection + end + + def new_connection + params = { :read_timeout => self.class.read_timeout, :write_timeout => self.class.write_timeout, - :connect_timeout => self.class.connect_timeout - ) + :connect_timeout => self.class.connect_timeout } + args = [ params ] + if self.class.minimum_version?("0.19.0") + params.merge!(:scheme => root_uri.scheme, + :host => root_uri.host, + :port => root_uri.port) + else + args.unshift root_uri.to_s + end + Excon::Connection.new(*args) end end end end