-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add ?meta=eof for trailling metadata dag-json #15
base: master
Are you sure you want to change the base?
Conversation
|
httpipfs.go
Outdated
@@ -113,14 +116,16 @@ func (hi *HttpIpfs) ServeHTTP(res http.ResponseWriter, req *http.Request) { | |||
return | |||
} | |||
|
|||
includeMeta := req.URL.Query().Get("meta") == "eof" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this is a CAR content type parameter, and should go to Accept
and Content-Type
headers, like ones from IPIP-412. (mentioning early to avoid costly renames later 😅)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, so the reasoning here is that anything that changes the format of the output should go in Content-Type
or Accept
? The content itself is dictated by the query parameters, but the way it's presented is dictated by these headers? Is that the right way to think about it?
So something like:
Accept: application/vnd.ipld.car; version=1; order=dfs; dups=y; meta=eof;
Shouldn't be hard to adapt this. We have a ParseAccept
in lassie that I'm using here which I'll just extend if that's where it goes.
…m http fetches Ref: ipfs/specs#431 Ref: ipld/frisbii#15
…m http fetches Ref: ipfs/specs#431 Ref: ipld/frisbii#15
…m http fetches Ref: ipfs/specs#431 Ref: ipld/frisbii#15
…m http fetches Ref: ipfs/specs#431 Ref: ipld/frisbii#15
…m http fetches Ref: ipfs/specs#431 Ref: ipld/frisbii#15
Prototype for an option for implementing ipfs/specs#431
Defines a new
meta
query parameter that, if it has a value ofeof
, will do the following:NUL
byte, such that the CARv1 is only now parseable with theZeroLengthSectionAsEOF
mode (I don't think we have this in js-car yet but it's not hard as an opt-in), but it cleanly terminates.Lassie should be able to pass in
?meta=eof
to HTTP retrievals, strip this message out (where it exists - remotes may not have it), and present the information separately; either via an API return property, or to stdout for the CLI.Examples (which you can run with curl):
curl 'http://ipfs.va.gg:3747/ipfs/bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze/wiki/Oregon_Cartoon_Institute?dag-scope=entity&meta=eof' -o foo.car
Pretty printed dag-json trailing bytes:
/cc @bajtos