go-fed / activity

ActivityStreams & ActivityPub in golang, oh my!
BSD 3-Clause "New" or "Revised" License
702 stars 111 forks source link

requestId supports only https => handler dereferences nil #143

Closed cjslep closed 3 years ago

cjslep commented 3 years ago

Please Describe The Problematic Behavior

Been developing on apcore, which when a binary is ran with the -dev flag everything is run as http. This means new actors, data, and activities, are created with http identifiers, and the server does not run a HTTPS variant. This allows easy local development without generating test HTTPS certificates.

The library is middleware for the app framework.

Tracked down a nil exception to pub/handlers.go:61 due to the database returning nothing.

pub/handlers.go:61 has t as nil. The requestId call improperly always assumes https.

https://github.com/go-fed/apcore/blob/master/framework/router.go#L431

The handler, when serializing, dereferences a nil.

Please Describe The Expected Behavior

requestId is able to use http and dereference. Also, the handler should be able to handle the "404 Not Found" case.

cjslep commented 3 years ago

be7f23bde7ec5d7d52c58269ba66148bca9e613f adds a new ErrNotFound error that handlers will return when they retrieve no data.

6cbfb30afa479a47ce1beeb99300f2cba07cf619 enables clients to use a Scheme variant of PostInbox, PostOutbox, and handlers if they wish. Otherwise, existing implementations will keep the existing https only behavior.

These two changes will require a minor version bump for next release.

cjslep commented 3 years ago

472d90163f3ab6912c5d19fe4965745f24fcfb3a Also adds the methods to the Actor interface.