fix http_server.Request

This commit is contained in:
Izalia Mae 2021-09-17 12:52:47 -04:00
parent 96f3e8a2d3
commit 3d0c813a32
2 changed files with 11 additions and 5 deletions

View file

@ -7,10 +7,10 @@ from .misc import Headers
class Request(sanic.request.Request): class Request(sanic.request.Request):
def __init__(self, url_bytes, headers, version, method, transport, app): def __init__(self, *args, **kwargs):
super().__init__(url_bytes, headers, version, method, transport, app) super().__init__(*args, **kwargs)
self.Headers = Headers(headers) self.Headers = Headers(self.headers)
self.address = self.headers.get('x-real-ip', self.forwarded.get('for', self.remote_addr)) self.address = self.headers.get('x-real-ip', self.forwarded.get('for', self.remote_addr))
self.data = Data(self) self.data = Data(self)
self.template = self.app.template self.template = self.app.template

View file

@ -9,7 +9,7 @@ from base64 import b64decode, b64encode
from datetime import datetime from datetime import datetime
from functools import lru_cache from functools import lru_cache
from izzylib import DefaultDotDict, DotDict from izzylib import DefaultDotDict, DotDict
from izzylib import izzylog as logging from izzylib import izzylog
from tldextract import extract from tldextract import extract
from urllib.parse import urlparse from urllib.parse import urlparse
@ -191,7 +191,13 @@ async def verify_request(request, actor: dict=None):
actor: A dictionary containing the activitypub actor and the link to the pubkey used for verification actor: A dictionary containing the activitypub actor and the link to the pubkey used for verification
''' '''
return verify_headers(request.Headers.to_dict(), request.method, request.path, actor, request.body) return verify_headers(
request.Headers.to_dict(),
request.method,
request.path,
actor = actor,
body = request.body
)