mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-15 12:35:22 -04:00
Merge remote-tracking branch 'upstream/release-v1.52'
This commit is contained in:
commit
9870604741
102 changed files with 2730 additions and 816 deletions
|
@ -732,15 +732,24 @@ class SimpleHttpClient:
|
|||
# straight back in again
|
||||
|
||||
try:
|
||||
length = await make_deferred_yieldable(
|
||||
read_body_with_max_size(response, output_stream, max_size)
|
||||
)
|
||||
d = read_body_with_max_size(response, output_stream, max_size)
|
||||
|
||||
# Ensure that the body is not read forever.
|
||||
d = timeout_deferred(d, 30, self.hs.get_reactor())
|
||||
|
||||
length = await make_deferred_yieldable(d)
|
||||
except BodyExceededMaxSize:
|
||||
raise SynapseError(
|
||||
HTTPStatus.BAD_GATEWAY,
|
||||
"Requested file is too large > %r bytes" % (max_size,),
|
||||
Codes.TOO_LARGE,
|
||||
)
|
||||
except defer.TimeoutError:
|
||||
raise SynapseError(
|
||||
HTTPStatus.BAD_GATEWAY,
|
||||
"Requested file took too long to download",
|
||||
Codes.TOO_LARGE,
|
||||
)
|
||||
except Exception as e:
|
||||
raise SynapseError(
|
||||
HTTPStatus.BAD_GATEWAY, ("Failed to download remote body: %s" % e)
|
||||
|
|
|
@ -407,7 +407,10 @@ class SynapseRequest(Request):
|
|||
|
||||
user_agent = get_request_user_agent(self, "-")
|
||||
|
||||
code = str(self.code)
|
||||
# int(self.code) looks redundant, because self.code is already an int.
|
||||
# But self.code might be an HTTPStatus (which inherits from int)---which has
|
||||
# a different string representation. So ensure we really have an integer.
|
||||
code = str(int(self.code))
|
||||
if not self.finished:
|
||||
# we didn't send the full response before we gave up (presumably because
|
||||
# the connection dropped)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue