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,9 +111,10 @@ def head_image_layer(namespace, repository, image_id, headers):
# downloads. # downloads.
if store.get_supports_resumeable_downloads(repo_image.storage.locations): if store.get_supports_resumeable_downloads(repo_image.storage.locations):
profile.debug('Storage supports resumeable downloads') profile.debug('Storage supports resumeable downloads')
extra_headers['Accept-Ranges'] = 'bytes'; extra_headers['Accept-Ranges'] = 'bytes'
resp = make_response('') resp = make_response('')
resp.headers.extend(headers)
resp.headers.extend(extra_headers) resp.headers.extend(extra_headers)
return resp return resp
@ -146,7 +147,7 @@ def get_image_layer(namespace, repository, image_id, headers):
return resp return resp
profile.debug('Streaming layer data') 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): except (IOError, AttributeError):
profile.debug('Image not found') profile.debug('Image not found')
abort(404, 'Image %(image_id)s not found', issue='unknown-image', abort(404, 'Image %(image_id)s not found', issue='unknown-image',