lib/wagon/connection.rb in wagon-2.0.0 vs lib/wagon/connection.rb in wagon-2.0.1

- old
+ new

@@ -16,11 +16,11 @@ def initialize(username, password) response = _post(LOGIN_PATH, 'username' => username, 'password' => password) @cookies = response['set-cookie'] @home_path = URI.parse(response['location']).path - raise AuthenticationFailure.new("Invalid username and/or password") unless @cookies + raise AuthenticationFailure.new("Invalid username and/or password") unless @cookies =~ /lds_scs_authentication=/ end def home_path @home_path end @@ -56,10 +56,14 @@ http.verify_mode = OpenSSL::SSL::VERIFY_NONE http end def _get(path) + attempts = 0 _http.request(Net::HTTP::Get.new(path, {'Cookie' => @cookies || ''})) + rescue Exception => e + retry unless (attempts += 1) == 3 + raise e end def _head(path) _http.request(Net::HTTP::Head.new(path, {'Cookie' => @cookies || ''})) end \ No newline at end of file