camallo / dkregistry-rs

A pure-Rust asynchronous library for Docker Registry API v2
Apache License 2.0
62 stars 39 forks source link

Send HEAD, not GET, when checking manifest existence #201

Closed tofay closed 3 years ago

tofay commented 3 years ago

I've updated the has_manifest function to send a HEAD request, as the response body isn't used.

vrutkovs commented 3 years ago

Seems to be allowed by https://docs.docker.com/registry/spec/api/

/cc @lucab to confirm

tofay commented 3 years ago

Seems to be allowed by https://docs.docker.com/registry/spec/api/

/cc @lucab to confirm

Yep, this PR is partly motivated by the fact that docker hub doesn't include HEAD requests in rate limit calculations: https://docs.docker.com/docker-hub/download-rate-limit/

lucab commented 3 years ago

I'm fine to merge this as it seems spec compliant.

However please note that this was initially a HEAD but it got turned into a GET in https://github.com/camallo/dkregistry-rs/pull/91, not sure if on purpose. As such, it may (or may not) regress on Satellite repos, depending on how close to specs that implementation is at this point (they used to have many quirks, and this may or may not have been one of those).