is_test = self.params.get('test', False)
chunk_size = self._TEST_FILE_SIZE if is_test else (
is_test = self.params.get('test', False)
chunk_size = self._TEST_FILE_SIZE if is_test else (
ctx.data_len = None
ctx.block_size = self.params.get('buffersize', 1024)
ctx.start_time = time.time()
ctx.data_len = None
ctx.block_size = self.params.get('buffersize', 1024)
ctx.start_time = time.time()
if self.params.get('continuedl', True):
# Establish possible resume length
if self.params.get('continuedl', True):
# Establish possible resume length
req.add_header('Range', range_header)
def establish_connection():
req.add_header('Range', range_header)
def establish_connection():
if range_end and ctx.data_len is not None and range_end >= ctx.data_len:
range_end = ctx.data_len - 1
has_range = range_start is not None
ctx.has_range = has_range
if range_end and ctx.data_len is not None and range_end >= ctx.data_len:
range_end = ctx.data_len - 1
has_range = range_start is not None
ctx.has_range = has_range
# Chunked download and requested piece or
# its part is promised to be served
content_range_end == range_end or
# Chunked download and requested piece or
# its part is promised to be served
content_range_end == range_end or
# Unable to resume (requested range not satisfiable)
try:
# Open the connection again without the range header
# Unable to resume (requested range not satisfiable)
try:
# Open the connection again without the range header
content_length = ctx.data.info()['Content-Length']
except (compat_urllib_error.HTTPError, ) as err:
if err.code < 500 or err.code >= 600:
content_length = ctx.data.info()['Content-Length']
except (compat_urllib_error.HTTPError, ) as err:
if err.code < 500 or err.code >= 600: