opencontainers / distribution-spec

OCI Distribution Specification
https://opencontainers.org
Apache License 2.0
823 stars 202 forks source link

Relax the `Content-Type` header check in `conformance /03_discovery_test` #456

Closed northtyphoon closed 1 year ago

northtyphoon commented 1 year ago

The following validation requires the server return Content-Type header application/vnd.oci.image.index.v1+json exactly. If the server returns application/vnd.oci.image.index.v1+json; charset=utf-8, it would fail. Can the test relax the validation to allow the additional charset parameter?

https://github.com/opencontainers/distribution-spec/blob/6bc87156eacf3b73362db343eb6b63d7abeedf7e/conformance/03_discovery_test.go#L294

https://github.com/opencontainers/distribution-spec/blob/6bc87156eacf3b73362db343eb6b63d7abeedf7e/conformance/03_discovery_test.go#L309

https://github.com/opencontainers/distribution-spec/blob/6bc87156eacf3b73362db343eb6b63d7abeedf7e/conformance/03_discovery_test.go#L329

sudo-bmitch commented 1 year ago

This gets into #408, which I'm having a hard time telling if there's a consensus on. Our spec for the header currently says:

The Content-Type header MUST be set to application/vnd.oci.image.index.v1+json.

northtyphoon commented 1 year ago

Thanks for the clarification. I assume 1.1 spec will stick to MUST?

sudo-bmitch commented 1 year ago

The referrers API was added in 1.1, and these tests are part of the RC for 1.1. So now it's the last chance to sort these things out before it gets released.

northtyphoon commented 1 year ago

We adjusted our implementation to follow the spec “MUST”. Thanks for the clarification again.