all repos — honk @ 0938615c034b3976defa79c4962556af4eeef61b

my fork of honk

sign the content-type instead of content-length
Ted Unangst tedu@tedunangst.com
Wed, 10 Apr 2019 19:54:46 -0400
commit

0938615c034b3976defa79c4962556af4eeef61b

parent

a8984000538dd76de12f4ea99eb4c5a0db7067c5

2 files changed, 3 insertions(+), 9 deletions(-)

jump to
M activity.goactivity.go

@@ -82,8 +82,8 @@ req, err := http.NewRequest("POST", url, &buf)

if err != nil { return err } - zig(keyname, key, req, buf.Bytes()) req.Header.Set("Content-Type", theonetruename) + zig(keyname, key, req, buf.Bytes()) resp, err := client.Do(req) if err != nil { return err
M zig.gozig.go

@@ -28,7 +28,6 @@ "fmt"

"io" "net/http" "regexp" - "strconv" "strings" "time" )

@@ -54,7 +53,7 @@ return sb64(h.Sum(nil))

} func zig(keyname string, key *rsa.PrivateKey, req *http.Request, content []byte) { - headers := []string{"(request-target)", "date", "host", "content-length", "digest"} + headers := []string{"(request-target)", "date", "host", "content-type", "digest"} var stuff []string for _, h := range headers { var s string

@@ -73,13 +72,8 @@ if s == "" {

s = req.URL.Hostname() req.Header.Set(h, s) } - case "content-length": + case "content-type": s = req.Header.Get(h) - if s == "" { - s = strconv.Itoa(len(content)) - req.Header.Set(h, s) - req.ContentLength = int64(len(content)) - } case "digest": s = req.Header.Get(h) if s == "" {