try a little harder to recover from httpsig failures
This commit is contained in:
parent
c9aba7ecba
commit
d167f26418
|
@ -2,6 +2,8 @@ changelog
|
|||
|
||||
-- next
|
||||
|
||||
+ Try a little harder to recover from httpsig failures.
|
||||
|
||||
+ Add cite tag for block quote attributions.
|
||||
|
||||
+ @media print styles.
|
||||
|
|
7
fun.go
7
fun.go
|
@ -28,6 +28,7 @@ import (
|
|||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/html"
|
||||
"humungus.tedunangst.com/r/webs/cache"
|
||||
|
@ -613,6 +614,12 @@ func zaggy(keyname string) *rsa.PublicKey {
|
|||
return key
|
||||
}
|
||||
|
||||
func savingthrow(keyname string) {
|
||||
when := time.Now().UTC().Sub(30 * time.Minute).Format(dbtimeformat)
|
||||
stmtDeleteXonker.Exec(keyname, "pubkey", when)
|
||||
zaggies.Clear(keyname)
|
||||
}
|
||||
|
||||
func keymatch(keyname string, actor string) string {
|
||||
hash := strings.IndexByte(keyname, '#')
|
||||
if hash == -1 {
|
||||
|
|
8
web.go
8
web.go
|
@ -330,6 +330,10 @@ func inbox(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
keyname, err := httpsig.VerifyRequest(r, payload, zaggy)
|
||||
if err != nil && keyname != "" {
|
||||
savingthrow(keyname)
|
||||
keyname, err = httpsig.VerifyRequest(r, payload, zaggy)
|
||||
}
|
||||
if err != nil {
|
||||
log.Printf("inbox message failed signature for %s from %s", keyname, r.Header.Get("X-Forwarded-For"))
|
||||
if keyname != "" {
|
||||
|
@ -460,6 +464,10 @@ func serverinbox(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
keyname, err := httpsig.VerifyRequest(r, payload, zaggy)
|
||||
if err != nil && keyname != "" {
|
||||
savingthrow(keyname)
|
||||
keyname, err = httpsig.VerifyRequest(r, payload, zaggy)
|
||||
}
|
||||
if err != nil {
|
||||
log.Printf("inbox message failed signature for %s from %s", keyname, r.Header.Get("X-Forwarded-For"))
|
||||
if keyname != "" {
|
||||
|
|
Loading…
Reference in New Issue