From 86f95ce056a1e3b2acd372c4fe3a49450b96b633 Mon Sep 17 00:00:00 2001 From: Nate Coraor <nate@bx.psu.edu> Date: Thu, 7 May 2015 14:31:09 -0400 Subject: [PATCH] 206 is the valid response code for a range request. --- pulsar/client/transport/curl.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pulsar/client/transport/curl.py b/pulsar/client/transport/curl.py index 25ed57a0..d2f0f50c 100644 --- a/pulsar/client/transport/curl.py +++ b/pulsar/client/transport/curl.py @@ -73,9 +73,11 @@ def get_file(url, path): if path and os.path.exists(path): buf = _open_output(path, 'ab') size = os.path.getsize(path) + success_codes = (200, 206) else: buf = _open_output(path) size = 0 + success_codes = (200,) try: c = _new_curl_object_for_url(url) c.setopt(c.WRITEFUNCTION, buf.write) @@ -83,8 +85,8 @@ def get_file(url, path): log.info('transfer of %s will resume at %s bytes', url, size) c.setopt(c.RESUME_FROM, size) c.perform() - status_code = c.getinfo(HTTP_CODE) - if int(status_code) != 200: + status_code = int(c.getinfo(HTTP_CODE)) + if status_code not in success_codes: message = GET_FAILED_MESSAGE % (url, status_code) raise Exception(message) finally: -- GitLab