diff options
Diffstat (limited to 'registry')
-rw-r--r-- | registry/registry.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/registry/registry.go b/registry/registry.go index 89dd7a1..ac486d9 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -13,6 +13,7 @@ import ( "net/url" "strings" "sync" + "time" "git.capotej.com/capotej/communique/config" "git.capotej.com/capotej/communique/models" @@ -250,6 +251,9 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.Act privKey := &keypair.PrivateKey request, err := http.NewRequest("POST", url.String(), bytes.NewBuffer(jsonData)) + request.Header.Set("Date", time.Now().Format(http.TimeFormat)) + request.Header.Set("Content-Type", "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") + r.log.With( "type", "delivery", @@ -259,10 +263,15 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.Act ).With( "digest", request.Header.Get("digest"), + ).With( + "date", + request.Header.Get("date"), + ).With( + "host", + request.Header.Get("host"), ).Debugf("signing request") r.mu.Lock() - defer r.mu.Unlock() prefs := []httpsig.Algorithm{httpsig.RSA_SHA256} digestAlgorithm := httpsig.DigestSha256 // The "Date" and "Digest" headers must already be set on r, as well as r.URL. @@ -276,6 +285,7 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl *url.URL, follow vocab.Act // body := nil // If r were a http.ResponseWriter, call SignResponse instead. err = signer.SignRequest(privKey, actorUrl.String(), request, nil) + r.mu.Unlock() r.log.With( "type", |