1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Follow redirection from response even if response is a Hash

This commit is contained in:
Marc G Gauthier 2013-02-25 10:36:28 +01:00
parent ba335baf48
commit c35f4affa7

View file

@ -400,7 +400,7 @@ DATA
begin begin
response = @connection.request(params, &block) response = @connection.request(params, &block)
rescue Excon::Errors::TemporaryRedirect => error rescue Excon::Errors::TemporaryRedirect => error
uri = URI.parse(error.response.headers['Location']) uri = URI.parse(error.response.is_a?(Hash) ? error.response[:headers]['Location'] : error.response.headers['Location'])
Fog::Logger.warning("fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant") Fog::Logger.warning("fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant")
response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false, @connection_options).request(original_params, &block) response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false, @connection_options).request(original_params, &block)
end end