Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change Ping to check for Docker header #199

Closed
wants to merge 1 commit into from

Conversation

jabielecki
Copy link

Change Registry.Ping() to:

  • respect http 401 response code as valid
  • conform to the Specs by requiring header
    Docker-Distribution-API-Version

Change the TokenTransport unit tests to emit that header.

Remove the naive workaround inside Registry.Pingable() as
iterating over all sites that do not support the old
ping would require huge and constant effort. (Not only GCR.)

I add separate Registry.PingClient, because the Client handles 401
by closing the body so it disables the possibility of disinguishing
whether the 401 contained Docker-Distribution-API-Version header.

Refactor: simplify current TestPingable

Closes #198

Change Registry.Ping() to:
  - respect http 401 response code as valid
  - conform to the Specs by requiring header
    Docker-Distribution-API-Version

Change the TokenTransport unit tests to emit that header.

Remove the naive workaround inside Registry.Pingable() as
iterating over all sites that do not support the old
ping would require huge and constant effort. (Not only GCR.)

I add separate Registry.PingClient, because the Client handles 401
by closing the body so it disables the possibility of disinguishing
whether the 401 contained Docker-Distribution-API-Version header.

Refactor: simplify current TestPingable
Signed-off-by: Jakub Bielecki <[email protected]>
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

registry/ping.go Show resolved Hide resolved
@jabielecki
Copy link
Author

jabielecki commented Feb 23, 2024

This has been merged into https://github.com/ttys3/reg fork which I now regard as the maintained source-of-truth for my future work with reg.

@jabielecki jabielecki closed this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

behavior of ping is against Docker v2 API Spec
1 participant