From ca68b27ccd97adbf9a68d19406a86f446e36b1f7 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 15 Sep 2019 14:27:34 +0100 Subject: [PATCH] actually pass signature and related headers to activity_request() --- modules/fediverse/ap_actor.py | 6 ++++-- modules/fediverse/ap_utils.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/fediverse/ap_actor.py b/modules/fediverse/ap_actor.py index 69387d55..ca15f12d 100644 --- a/modules/fediverse/ap_actor.py +++ b/modules/fediverse/ap_actor.py @@ -50,6 +50,8 @@ class Inbox(object): sign_headers.insert(0, ["(request-target)", "post %s" % parts.path]) signature = ap_security.signature(private_key, sign_headers) - return ap_utils.activity_request(self._url, activity.format(sender), - method="POST") + headers.append(["signature", signature]) + + return ap_utils.activity_request(self._url, activity.format(sender), + method="POST", headers=headers) diff --git a/modules/fediverse/ap_utils.py b/modules/fediverse/ap_utils.py index 8a315f18..d7bec412 100644 --- a/modules/fediverse/ap_utils.py +++ b/modules/fediverse/ap_utils.py @@ -14,9 +14,9 @@ def split_username(s): return username, instance return None, None -def activity_request(url, data=None, method="GET", type=ACTIVITY_TYPE): +def activity_request(url, data=None, method="GET", type=ACTIVITY_TYPE, + headers={}): content_type = None - headers = {} if method == "POST": content_type = type