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

fix(gw): validate requested CAR version #8835

Merged
merged 2 commits into from Apr 1, 2022
Merged

Conversation

lidel
Copy link
Member

@lidel lidel commented Mar 31, 2022

CAR responses were added in #8758

This PR adds validation of application/vnd.ipld.car;version=n passed in the Accept header by HTTP clients.
We need this to align Gateway behavior with the spec submitted to IANA (ipfs/in-web-browsers#192).

tl;dr:

  • Gateway returns HTTP 400 Bad Request error when request is for unsupported CAR version (right now we only support CARv1)
  • Proper parsing of media types using mime.ParseMediaType means we don't need to worry about clients adding/removing whitespace or using custom case

This adds validation of 'application/vnd.ipld.car;version=n' passed
in the Accept header by HTTP clients to align Gateway behavior with
the spec submitted to IANA.
@lidel lidel added this to the go-ipfs 0.13 milestone Mar 31, 2022
@lidel lidel requested a review from guseggert March 31, 2022 13:09
@lidel lidel self-assigned this Mar 31, 2022
Co-authored-by: Gus Eggert <gus@gus.dev>
@BigLep BigLep merged commit 5fa5569 into master Apr 1, 2022
@BigLep BigLep deleted the fix/gw-content-type-params branch April 1, 2022 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants