Add an additional short circuit to avoid parsing the manifest when not necessary for older Docker clients

We also add tests for this case
This commit is contained in:
Joseph Schorr 2019-01-11 16:37:23 -05:00
parent 7f068c3fc3
commit e78b5c5516
3 changed files with 36 additions and 4 deletions

View file

@ -208,7 +208,7 @@ class V2Protocol(RegistryProtocol):
headers = {
'Authorization': 'Bearer ' + token,
'Accept': ','.join(options.accept_mimetypes) if options.accept_mimetypes else '*/*',
'Accept': ','.join(options.accept_mimetypes) if options.accept_mimetypes is not None else '*/*',
}
# Push all blobs.
@ -340,7 +340,7 @@ class V2Protocol(RegistryProtocol):
headers = {
'Authorization': 'Bearer ' + token,
'Accept': ','.join(options.accept_mimetypes) if options.accept_mimetypes else '*/*',
'Accept': ','.join(options.accept_mimetypes) if options.accept_mimetypes is not None else '*/*',
}
# Build fake manifests.
@ -530,7 +530,9 @@ class V2Protocol(RegistryProtocol):
}
if self.schema2:
headers['Accept'] = ','.join(options.accept_mimetypes or DOCKER_SCHEMA2_CONTENT_TYPES)
headers['Accept'] = ','.join(options.accept_mimetypes
if options.accept_mimetypes is not None
else DOCKER_SCHEMA2_CONTENT_TYPES)
manifests = {}
image_ids = {}