Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit d8df8e6

Browse files
David Robertsonbabolivier
andauthored
Don't print HTTPStatus.* in "Processed..." logs (#11827)
* Don't print HTTPStatus.* in "Processed..." logs Fixes #11812. See also #7118 and #7188 (comment) in particular. Co-authored-by: Brendan Abolivier <[email protected]>
1 parent c581556 commit d8df8e6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

changelog.d/11827.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug introduced in Synapse 0.33.3 causing requests to sometimes log strings such as `HTTPStatus.OK` instead of integer status codes.

synapse/http/site.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,10 @@ def _finished_processing(self) -> None:
407407

408408
user_agent = get_request_user_agent(self, "-")
409409

410-
code = str(self.code)
410+
# int(self.code) looks redundant, because self.code is already an int.
411+
# But self.code might be an HTTPStatus (which inherits from int)---which has
412+
# a different string representation. So ensure we really have an integer.
413+
code = str(int(self.code))
411414
if not self.finished:
412415
# we didn't send the full response before we gave up (presumably because
413416
# the connection dropped)

0 commit comments

Comments
 (0)