Don't send content-length when redirecting v2 blob

Fixes #1012
This commit is contained in:
Silas Sewell 2015-12-02 01:52:58 -05:00
parent b95f47ee73
commit 664a2951cc

View file

@ -38,7 +38,6 @@ def _base_blob_fetch(namespace, repo_name, digest):
headers = {
'Docker-Content-Digest': digest,
'Content-Length': found.image_size,
}
# Add the Accept-Ranges header if the storage engine supports resumable
@ -56,11 +55,11 @@ def _base_blob_fetch(namespace, repo_name, digest):
@anon_protect
@cache_control(max_age=31436000)
def check_blob_exists(namespace, repo_name, digest):
_, headers = _base_blob_fetch(namespace, repo_name, digest)
found, headers = _base_blob_fetch(namespace, repo_name, digest)
response = make_response('')
response.headers.extend(headers)
response.headers['Content-Length'] = headers['Content-Length']
response.headers['Content-Length'] = found.image_size
return response
@ -87,6 +86,8 @@ def download_blob(namespace, repo_name, digest):
# Close the database handle here for this process before we send the long download.
database.close_db_filter(None)
headers['Content-Length'] = found.image_size
return Response(storage.stream_read(found.locations, path), headers=headers)