From 8f382232845ae6eb166baf13c1b51883e2a57c18 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 19 Sep 2019 15:28:42 +0100 Subject: [PATCH] fedi http headers should be PascalCase --- modules/fediverse/ap_actor.py | 4 ++-- modules/fediverse/ap_security.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/fediverse/ap_actor.py b/modules/fediverse/ap_actor.py index c1c4c980..ace35acf 100644 --- a/modules/fediverse/ap_actor.py +++ b/modules/fediverse/ap_actor.py @@ -46,8 +46,8 @@ class Inbox(object): now = email.utils.formatdate(timeval=None, localtime=False, usegmt=True) parts = urllib.parse.urlparse(self._url) headers = [ - ["host", parts.netloc], - ["date", now] + ["Host", parts.netloc], + ["Date", now] ] sign_headers = headers[:] sign_headers.insert(0, ["(request-target)", "post %s" % parts.path]) diff --git a/modules/fediverse/ap_security.py b/modules/fediverse/ap_security.py index 391c58de..f7d17a2e 100644 --- a/modules/fediverse/ap_security.py +++ b/modules/fediverse/ap_security.py @@ -23,9 +23,9 @@ class PrivateKey(object): def signature(key: PrivateKey, headers: typing.List[typing.Tuple[str, str]] ) -> str: - sign_header_keys = " ".join(h[0] for h in headers) + sign_header_keys = " ".join(h[0].lower() for h in headers) - sign_string_parts = ["%s: %s" % (k, v) for k, v in headers] + sign_string_parts = ["%s: %s" % (k.lower(), v) for k, v in headers] sign_string = "\n".join(sign_string_parts) signature = key.key.sign(