Use standard-compliant Accept header when fetching #740
No reviewers
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#740
Loading…
Reference in a new issue
No description provided.
Delete branch "Oneric/akkoma:fetch_std-accept-hdr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Quoting #730
In the end only mocks from one file needed updating for the new headers.
Fixes: #730
hm, but we can't actually process jsonLD - my first thought is that if we were actually given pure LD we'd just crash out
I don’t think this makes any difference here, the ActivityStream profile the AP-spec-compliant header references already imposes some restrictions (e.g. having gone through JSON-LD compaction) and in fact is the same spec which defines
application/activity+json
. The ActivityStreams 2.0 spec also already declares both those media types to be equivalent (but unlike the higher-level AP spec, AS prefersactivity+json
).Taking a look at other servers now, interestingly most seem to use multiple
Accept
types though details differ and i’m not sure if this is actually (still) required:Accept
, givingactivity+json
higher priorityAccept
, giving theld+json
one higher priorityapplication/activity+json
and the secondapplication/ld+json
without a profile (now this would be problematic for us)(I’m not sure about any of them, but i believe Mastodon and Misskey don’t process pure JSON-LD either?)
a4ce87a231
tofae0a14ee8
Ok, GoToSocial added
application/activity+json
in 2022.05, to workaround Owncast mistakenly only responding toapplication/activity+json
andapplication/json
. The Owncast bug was fixed a month prior to that (but presumably didn’t make it into a release yet).Although there’s no known implementation requiring the non-compliant header, perhaps it’s best to still set both values in
Accept
(preferring the spec-compliant one). It’s easy for us to do and given the prevalence of multipleAccept
values it seems unlikely any implementation will have issues with more than one entry here.Updated the patch accordingly; using two
"accept"
headers rather than a pre-merged one with a separating comma seemed more idiomatic for Plug and allowsget_*_headers
to correctly return a list of all accepted types in testsAlso made sure this can still fetch from Akkoma, Misskey and Mastodon instances (if auth-fetch is disabled)
all passes, should be good, thanks a lot!