mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 14:04:55 -04:00
Move request_id management into SynapseRequest
This commit is contained in:
parent
18e144fe08
commit
8460e48d06
2 changed files with 25 additions and 15 deletions
|
@ -22,6 +22,8 @@ import time
|
|||
|
||||
ACCESS_TOKEN_RE = re.compile(br'(\?.*access(_|%5[Ff])token=)[^&]*(.*)$')
|
||||
|
||||
_next_request_seq = 0
|
||||
|
||||
|
||||
class SynapseRequest(Request):
|
||||
def __init__(self, site, *args, **kw):
|
||||
|
@ -30,6 +32,10 @@ class SynapseRequest(Request):
|
|||
self.authenticated_entity = None
|
||||
self.start_time = 0
|
||||
|
||||
global _next_request_seq
|
||||
self.request_seq = _next_request_seq
|
||||
_next_request_seq += 1
|
||||
|
||||
def __repr__(self):
|
||||
# We overwrite this so that we don't log ``access_token``
|
||||
return '<%s at 0x%x method=%s uri=%s clientproto=%s site=%s>' % (
|
||||
|
@ -41,6 +47,9 @@ class SynapseRequest(Request):
|
|||
self.site.site_tag,
|
||||
)
|
||||
|
||||
def get_request_id(self):
|
||||
return "%s-%i" % (self.method, self.request_seq)
|
||||
|
||||
def get_redacted_uri(self):
|
||||
return ACCESS_TOKEN_RE.sub(
|
||||
br'\1<redacted>\3',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue