diff options
author | FChannel <> | 2021-06-25 14:55:18 -0700 |
---|---|---|
committer | FChannel <> | 2021-06-25 14:55:18 -0700 |
commit | 80bcce22a2368c3911137dec97d6744dee328809 (patch) | |
tree | 0030d95bd0cc32562dd4652e93920e86188fcac5 /verification.go | |
parent | 3b806e4603a7da8bb6a24029a0115e18a6b7ba5b (diff) |
more cleaning up to better intergrate with plemroma standards. can verify signatures better
Diffstat (limited to 'verification.go')
-rw-r--r-- | verification.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/verification.go b/verification.go index 7c634e1..db44689 100644 --- a/verification.go +++ b/verification.go @@ -615,35 +615,42 @@ func VerifyHeaderSignature(r *http.Request, actor Actor) bool { var contentLength string var sig string - for _, e := range s.Headers { + for i, e := range s.Headers { + + var nl string + if i < len(s.Headers) - 1 { + nl = "\n" + } + + if e == "(request-target)" { method = strings.ToLower(r.Method) path = r.URL.Path - sig += "(request-target): " + method + " " + path + "\\n" + sig += "(request-target): " + method + " " + path + "" + nl continue } if e == "host" { host = r.Host - sig += "host: " + host + "\\n" + sig += "host: " + host + "" + nl continue } if e == "date" { date = r.Header.Get("date") - sig += "date: " + date + sig += "date: " + date + "" + nl continue } if e == "digest" { digest = r.Header.Get("digest") - sig += "digest: " + digest + sig += "digest: " + digest + "" + nl continue } if e == "content-length" { contentLength = r.Header.Get("content-length") - sig += "content-length: " + contentLength + sig += "content-length: " + contentLength + "" + nl continue } } |