From 8fc6a3c0b61055ad76e91f45eb68c546d6681887 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 27 Jun 2023 19:33:48 +0100 Subject: [PATCH] Tidying --- daemon.py | 58 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/daemon.py b/daemon.py index 4a85356f5..0162071ea 100644 --- a/daemon.py +++ b/daemon.py @@ -17269,6 +17269,7 @@ class PubServer(BaseHTTPRequestHandler): print('Authorization token refused for ' + 'offers collection federation') # show offers collection for federation + offers_json = [] if self._has_accept(calling_domain) and \ offers_collection_authorized: if self.server.debug: @@ -17296,21 +17297,19 @@ class PubServer(BaseHTTPRequestHandler): max_shares_per_account, shared_items_federated_domains, 'shares') - msg_str = json.dumps(offers_json, - ensure_ascii=False) - msg_str = self._convert_domains(calling_domain, - referer_domain, - msg_str) - msg = msg_str.encode('utf-8') - msglen = len(msg) - accept_str = self.headers['Accept'] - protocol_str = \ - get_json_content_from_accept(accept_str) - self._set_headers(protocol_str, msglen, - None, calling_domain, False) - self._write(msg) - return - self._400() + msg_str = json.dumps(offers_json, + ensure_ascii=False) + msg_str = self._convert_domains(calling_domain, + referer_domain, + msg_str) + msg = msg_str.encode('utf-8') + msglen = len(msg) + accept_str = self.headers['Accept'] + protocol_str = \ + get_json_content_from_accept(accept_str) + self._set_headers(protocol_str, msglen, + None, calling_domain, False) + self._write(msg) return # wanted items collection for this instance @@ -17351,6 +17350,7 @@ class PubServer(BaseHTTPRequestHandler): print('Authorization token refused for ' + 'wanted collection federation') # show wanted collection for federation + wanted_json = [] if self._has_accept(calling_domain) and \ wanted_collection_authorized: if self.server.debug: @@ -17378,21 +17378,19 @@ class PubServer(BaseHTTPRequestHandler): max_shares_per_account, shared_items_federated_domains, 'wanted') - msg_str = json.dumps(wanted_json, - ensure_ascii=False) - msg_str = self._convert_domains(calling_domain, - referer_domain, - msg_str) - msg = msg_str.encode('utf-8') - msglen = len(msg) - accept_str = self.headers['Accept'] - protocol_str = \ - get_json_content_from_accept(accept_str) - self._set_headers(protocol_str, msglen, - None, calling_domain, False) - self._write(msg) - return - self._400() + msg_str = json.dumps(wanted_json, + ensure_ascii=False) + msg_str = self._convert_domains(calling_domain, + referer_domain, + msg_str) + msg = msg_str.encode('utf-8') + msglen = len(msg) + accept_str = self.headers['Accept'] + protocol_str = \ + get_json_content_from_accept(accept_str) + self._set_headers(protocol_str, msglen, + None, calling_domain, False) + self._write(msg) return # shared items catalog for this instance