mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-25 23:33:31 -06:00
[feature] Add Mastodon-compatible HTTP signature fallback (#2659)
On outgoing `GET` requests that are signed (e.g. authorized fetch), if the initial request fails with `401`, try again, but _without_ the query parameters included in the HTTP signature. This is primarily useful for compatibility with Mastodon; though hopefully this can be removed in the not-too-distant future, as they've started changing their behavior here. Signed-off-by: Milas Bowman <devnull@milas.dev>
This commit is contained in:
parent
2db115fa36
commit
af1a26a68f
3 changed files with 16 additions and 8 deletions
|
|
@ -30,13 +30,13 @@ var (
|
|||
)
|
||||
|
||||
// NewGETSigner returns a new httpsig.Signer instance initialized with GTS GET preferences.
|
||||
func NewGETSigner(expiresIn int64) (httpsig.Signer, error) {
|
||||
func NewGETSigner(expiresIn int64) (httpsig.SignerWithOptions, error) {
|
||||
sig, _, err := httpsig.NewSigner(prefs, digestAlgo, getHeaders, httpsig.Signature, expiresIn)
|
||||
return sig, err
|
||||
}
|
||||
|
||||
// NewPOSTSigner returns a new httpsig.Signer instance initialized with GTS POST preferences.
|
||||
func NewPOSTSigner(expiresIn int64) (httpsig.Signer, error) {
|
||||
func NewPOSTSigner(expiresIn int64) (httpsig.SignerWithOptions, error) {
|
||||
sig, _, err := httpsig.NewSigner(prefs, digestAlgo, postHeaders, httpsig.Signature, expiresIn)
|
||||
return sig, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue