Skip to content

Commit 86f95ce

Browse files
committed
206 is the valid response code for a range request.
1 parent 4ed7c5d commit 86f95ce

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pulsar/client/transport/curl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,20 @@ def get_file(url, path):
7373
if path and os.path.exists(path):
7474
buf = _open_output(path, 'ab')
7575
size = os.path.getsize(path)
76+
success_codes = (200, 206)
7677
else:
7778
buf = _open_output(path)
7879
size = 0
80+
success_codes = (200,)
7981
try:
8082
c = _new_curl_object_for_url(url)
8183
c.setopt(c.WRITEFUNCTION, buf.write)
8284
if size > 0:
8385
log.info('transfer of %s will resume at %s bytes', url, size)
8486
c.setopt(c.RESUME_FROM, size)
8587
c.perform()
86-
status_code = c.getinfo(HTTP_CODE)
87-
if int(status_code) != 200:
88+
status_code = int(c.getinfo(HTTP_CODE))
89+
if status_code not in success_codes:
8890
message = GET_FAILED_MESSAGE % (url, status_code)
8991
raise Exception(message)
9092
finally:

0 commit comments

Comments
 (0)