mirror of https://gitlab.com/bashrc2/epicyon
Move function out of daemon
parent
652529bec3
commit
c21e20ece5
18
daemon.py
18
daemon.py
|
@ -409,6 +409,7 @@ from cache import check_for_changed_actor
|
||||||
from cache import store_person_in_cache
|
from cache import store_person_in_cache
|
||||||
from cache import get_person_from_cache
|
from cache import get_person_from_cache
|
||||||
from cache import get_person_pub_key
|
from cache import get_person_pub_key
|
||||||
|
from httpsig import getheader_signature_input
|
||||||
from httpsig import verify_post_headers
|
from httpsig import verify_post_headers
|
||||||
from theme import reset_theme_designer_settings
|
from theme import reset_theme_designer_settings
|
||||||
from theme import set_theme_from_designer
|
from theme import set_theme_from_designer
|
||||||
|
@ -548,21 +549,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.http_prefix + '://' + self.server.domain_full
|
self.server.http_prefix + '://' + self.server.domain_full
|
||||||
return instance_url
|
return instance_url
|
||||||
|
|
||||||
def _getheader_signature_input(self):
|
|
||||||
"""There are different versions of http signatures with
|
|
||||||
different header styles
|
|
||||||
"""
|
|
||||||
if self.headers.get('Signature-Input'):
|
|
||||||
# https://tools.ietf.org/html/
|
|
||||||
# draft-ietf-httpbis-message-signatures-01
|
|
||||||
return self.headers['Signature-Input']
|
|
||||||
if self.headers.get('signature-input'):
|
|
||||||
return self.headers['signature-input']
|
|
||||||
if self.headers.get('signature'):
|
|
||||||
# Ye olde Masto http sig
|
|
||||||
return self.headers['signature']
|
|
||||||
return None
|
|
||||||
|
|
||||||
def handle_error(self, request, client_address):
|
def handle_error(self, request, client_address):
|
||||||
"""HTTP server error handling
|
"""HTTP server error handling
|
||||||
"""
|
"""
|
||||||
|
@ -24240,7 +24226,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
'_POST', 'inbox_message_has_params',
|
'_POST', 'inbox_message_has_params',
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
|
|
||||||
header_signature = self._getheader_signature_input()
|
header_signature = getheader_signature_input(self.headers)
|
||||||
|
|
||||||
if header_signature:
|
if header_signature:
|
||||||
if 'keyId=' not in header_signature:
|
if 'keyId=' not in header_signature:
|
||||||
|
|
16
httpsig.py
16
httpsig.py
|
@ -567,3 +567,19 @@ def verify_post_headers(http_prefix: str,
|
||||||
if debug:
|
if debug:
|
||||||
print('EX: verify_post_headers pkcs1_15 verify failure')
|
print('EX: verify_post_headers pkcs1_15 verify failure')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def getheader_signature_input(headers: {}):
|
||||||
|
"""There are different versions of http signatures with
|
||||||
|
different header styles
|
||||||
|
"""
|
||||||
|
if headers.get('Signature-Input'):
|
||||||
|
# https://tools.ietf.org/html/
|
||||||
|
# draft-ietf-httpbis-message-signatures-01
|
||||||
|
return headers['Signature-Input']
|
||||||
|
if headers.get('signature-input'):
|
||||||
|
return headers['signature-input']
|
||||||
|
if headers.get('signature'):
|
||||||
|
# Ye olde Masto http sig
|
||||||
|
return headers['signature']
|
||||||
|
return None
|
||||||
|
|
Loading…
Reference in New Issue