diff options
author | Tim Burke <tim.burke@gmail.com> | 2023-02-15 21:00:51 -0800 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2023-02-15 21:01:07 -0800 |
commit | ff6b359d066981861f35fbc31803321a6e6b3304 (patch) | |
tree | 1db6941780462ed09ff91a019cd7f89c4088d040 | |
parent | 7bd09510864e92265eb1e797ba5bba973e0ceb50 (diff) | |
download | python-swiftclient-ff6b359d066981861f35fbc31803321a6e6b3304.tar.gz |
Retry with fresh socket on 499
Change-Id: I0c22eefb587375997672724c03744c9cda473708
-rw-r--r-- | swiftclient/client.py | 4 | ||||
-rw-r--r-- | test/unit/test_swiftclient.py | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py index e42ac70..b9f12aa 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 ae3e76f..55b4679 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) |