Ben Pate

Ben Pate

Among other things, I write software for the Fediverse.
Denver, Colorado 🇺🇸

Content Types on the Fediverse are a mess.  Today I worked through an especially nasty (and undocumented) "gotcha" that was preventing Emissary from Federating with other servers.

Apparently, all of these are valid requests for an ActivityPub document, and each Fediverse app uses a slightly different accent on their incantations:

```
Accept: application/activity+json
Accept: application/activity+json; charset=utf-8
Accept: application/activity+json; random comments about your mom
Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"
Accept: application/ld+json
Accept: application/activity+json, application/ld+json
Accept: application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"
Accept: application/json
```

Yes, I know: all of these *are* valid per the HTTP spec.  That's on me.  But every online tutorial glosses over the mess and pretends that everyone is out there using `application/activity+json` like Mr. Rogers holding a cup of chamomile and not whatever is actually going on up above like a pre-therapy Axl Rose signing "Get in The Ring" to a stadium of methed up raccoons.

The bottom line is this: don't trust that another server is going to send requests with sane arguments.  Filter your inputs heavily and expect the absolute worst behavior from everyone and you won't be disappointed 😅

3 weeks ago

Hi, I'm Ben.  I'm moving my most jargon-filled posts here because sometimes I talk to normies outside of the software developer world and I don't want to scare them away.

Maybe some day I'll add some permanent content to this site, but for now I really want to start ranting about today's debugging session.
3 weeks ago
Loading recent posts...