all repos — honk @ fd3ea6b86b58eec7a6787aee5558349d009e3569

my fork of honk

can skip some rsa work if we know we don't care about the result
Ted Unangst tedu@tedunangst.com
Tue, 05 Nov 2019 01:03:23 -0500
commit

fd3ea6b86b58eec7a6787aee5558349d009e3569

parent

6a023c68af35f481cc88e2679b4945343e493a0e

1 files changed, 11 insertions(+), 8 deletions(-)

jump to
M web.goweb.go

@@ -305,9 +305,19 @@ os.Stdout.Write(payload)

io.WriteString(os.Stdout, "\n") return } + if crappola(j) { return } + what, _ := j.GetString("type") + if what == "Like" { + return + } + who, _ := j.GetString("actor") + if rejectactor(user.ID, who) { + return + } + 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"))

@@ -320,19 +330,12 @@ }

http.Error(w, "what did you call me?", http.StatusTeapot) return } - what, _ := j.GetString("type") - if what == "Like" { - return - } - who, _ := j.GetString("actor") origin := keymatch(keyname, who) if origin == "" { log.Printf("keyname actor mismatch: %s <> %s", keyname, who) return } - if rejectactor(user.ID, who) { - return - } + switch what { case "Ping": obj, _ := j.GetString("id")