swicg / activitypub-html-discovery

Other
20 stars 0 forks source link

2.1.1 content negotiation failure — backcheck? #23

Open julianlam opened 3 weeks ago

julianlam commented 3 weeks ago

A more difficult failure mode to detect arises when the server does not support ActivityPub, but does support content negotiation for another JSON format. Such a server returns a 200 OK status code with a JSON object that does not use JSON-LD, or JSON-LD object that does not use the Activity Streams 2.0 vocabulary...

If one sends Accept: application/activity+json and received JSON back, you're right that you don't know whether it's JSON-LD. You could theoretically backcheck this by checking the received Content-Type.

I would assume compliant AP implementations would send the appropriate header, but more importantly, I can absolutely rely on non-compliant implementations to not send the appropriate header back.

evanp commented 1 week ago

I think it's more of a situation when you use more general JSON types, like this:

GET /resource HTTP/1.1
Host: mixed.example
Accept: application/activity+json, application/ld+json, application/json

I'll update the failure mode to be more clear that it's only when you accept non-AS2 JSON media types that compliant servers might not return AS2.