diff --git a/swiftclient/client.py b/swiftclient/client.py index e42ac700..b9f12aac 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -1821,7 +1821,9 @@ class Connection: retried_auth = True elif self.attempts > self.retries or err.http_status is None: raise - elif err.http_status == 408: + elif err.http_status in (408, 499): + # Server hit a timeout, so HTTP request/response framing + # are likely in a bad state; trash the connection self.http_conn = None elif 500 <= err.http_status <= 599: pass diff --git a/test/unit/test_swiftclient.py b/test/unit/test_swiftclient.py index ae3e76fd..55b4679a 100644 --- a/test/unit/test_swiftclient.py +++ b/test/unit/test_swiftclient.py @@ -2224,6 +2224,7 @@ class TestConnection(MockHttpTest): do_test(401, 2) # others will be tried until retry limits do_test(408, 6) + do_test(499, 6) do_test(500, 6) do_test(503, 6)