Skip to content

Conversation

@lucab
Copy link
Contributor

@lucab lucab commented Jan 14, 2019

This fixes endpoints examples to return the proper application/json
content-type for JSON content.

As per IETF specification and IANA registry below, the application/json
type is a binary media, so the content-type label does not need any
text-charset selector. Additionally, the media type definition
explicitly states that it has no required nor optional parameters,
which makes the current registry headers non-compliant.

Ref: https://www.iana.org/assignments/media-types/application/json

Signed-off-by: Luca Bruno luca.bruno@coreos.com

This fixes endpoints examples to return the proper `application/json`
content-type for JSON content.

As per IETF specification and IANA registry below, the `application/json`
type is a binary media, so the content-type label does not need any
text-charset selector. Additionally, the media type definition
explicitly states that it has no required nor optional parameters,
which makes the current registry headers non-compliant.

Ref: https://www.iana.org/assignments/media-types/application/json

Signed-off-by: Luca Bruno <luca.bruno@coreos.com>
@lucab
Copy link
Contributor Author

lucab commented Jan 14, 2019

This originally comes from distribution/distribution#2813, and tries to solve the ambiguity of a non-standard content-type which was the root cause of this k8s+containerd+quay regression kubernetes/kubernetes#72863 (comment).

@dmcgowan @vbatts PTAL.

@vbatts
Copy link
Member

vbatts commented Jan 14, 2019

LGTM

Approved with PullApprove

@jzelinskie
Copy link
Member

jzelinskie commented Jan 14, 2019

This should probably be cross posted, but here we go:

The details of the regression was that Quay added ; charset=utf8 to the Content-Type for manifests. This broke clients. However, for error messages, docker/distribution has always had the charset in addition to application/json. While this isn't technically correct, I'm not sure whether or not removing this field for v1 of OCI will break backcompat with certain clients. The tests for having that charset field are abundant in docker/distribution and I don't know if many of the clients are as diligent about checking for it.

I do agree that we should remove it, if we're confident it won't break existing clients.

@dmcgowan dmcgowan added this to the v1.0 RC1 milestone Jan 16, 2019
@stevvooe
Copy link
Contributor

stevvooe commented Jan 16, 2019

LGTM

This was pulled from examples on other apis. Clients that choke on this have a bug anyways, so I’m not sure claiming this is the root cause is quite right. Correct handling on the client will parse out the field and ignore it if it doesn’t apply.

Approved with PullApprove

@jzelinskie
Copy link
Member

I think most of the code that checks for the charset was written by you, @stevvooe. So if you think it's fine, I'll rubber stamp it.

My experience with working with http headers in Go is that nothing in net/http helps you with the values pulled out of headers (e.g. splitting on ;). Thus, I suspect that docker clients might choke, but this is something we should fix sooner rather than later.

@lucab
Copy link
Contributor Author

lucab commented Feb 6, 2019

Bump, does this need more green-stamps or can it be merged already?

@jzelinskie
Copy link
Member

jzelinskie commented Feb 7, 2019

LGTM

Approved with PullApprove

@jzelinskie jzelinskie merged commit f67bc11 into opencontainers:master Feb 7, 2019
@lucab lucab deleted the ups/spec-json-binary branch March 29, 2024 14:06
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.

5 participants