Fix some bugs with resume support.

This commit is contained in:
Jake Moshenko 2014-07-07 18:19:52 -04:00
parent f40b7dbc54
commit c40f6abb7a

View file

@ -111,12 +111,13 @@ def head_image_layer(namespace, repository, image_id, headers):
# downloads.
if store.get_supports_resumeable_downloads(repo_image.storage.locations):
profile.debug('Storage supports resumeable downloads')
extra_headers['Accept-Ranges'] = 'bytes';
extra_headers['Accept-Ranges'] = 'bytes'
resp = make_response('')
resp.headers.extend(headers)
resp.headers.extend(extra_headers)
return resp
abort(403)
@ -146,12 +147,12 @@ def get_image_layer(namespace, repository, image_id, headers):
return resp
profile.debug('Streaming layer data')
return Response(store.stream_read(repo_image.storage.locations, path), headers=dict(headers, **extra_headers))
return Response(store.stream_read(repo_image.storage.locations, path), headers=headers)
except (IOError, AttributeError):
profile.debug('Image not found')
abort(404, 'Image %(image_id)s not found', issue='unknown-image',
image_id=image_id)
abort(403)