kaniini / jejune

no-nonsense activitypub implementation
Other
27 stars 2 forks source link

Accept header parsing is too restrictive #2

Closed puckipedia closed 3 years ago

puckipedia commented 3 years ago

Requests with an Accept header of e.g. application/ld+json;profile="https://www.w3.org/ns/activitystreams",application/activity+json, or application/activity+json;q=1.0,text/html;q=0.8 aren't accepted, breaking RFC7231 based content negotiation, and making it not possible to cleanly fetch AS2 JSON with HTML fallback in one request.

kaniini commented 3 years ago

yep, it's true!

i assume this is about the friendly URIs, as the id is always the AS2 JSON content.

aiohttp has some content negotiation stuff, but i wanted to get something working quick and dirty for that. going to do it right for M2.

also on a personal note, i'm glad to hear from you!

puckipedia commented 3 years ago

Yeah, it is about the friendly URLs indeed; did some quick checking against Kroeg (it's an easy way to test conformance of some of the weirder parts of the spec :p), and those URLs just did not resolve properly. It's also very cool to see some non-microblogging-adjacent fediverse software! :)

kaniini commented 3 years ago

The aiohttp accept handling stuff looked really complex, so I rolled my own.

puckipedia commented 3 years ago

haha yeah. i ended up rolling most of Kroeg's infrastructure myself because of similar reasons..

Of note, i think the default q should be 1.0, and i think whitespace handling is missing? but those are nits, and this seems to do the right thing in most cases :p