diff --git a/pulsar/client/transport/curl.py b/pulsar/client/transport/curl.py index 25ed57a05b158a954cf7031f157c614b3929d625..d2f0f50cf52fbfca52c264194e53ba134977a7a5 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: