diff options
author | Till Faelligen <2353100+S7evinK@users.noreply.github.com> | 2024-08-08 14:59:23 +0200 |
---|---|---|
committer | Till Faelligen <2353100+S7evinK@users.noreply.github.com> | 2024-08-08 14:59:23 +0200 |
commit | 208630bbb07fac1bf8f22d4a6f059e2ac6e0dbd5 (patch) | |
tree | 96aa4846f908d7d5e1044d23df7af6a03a4e0d81 | |
parent | SSS: Implement PREVIOUSLY room tracking (#17535) (diff) | |
download | synapse-208630bbb07fac1bf8f22d4a6f059e2ac6e0dbd5.tar.xz |
Use `max_upload_size` as the limit when following the `Location` header
-rw-r--r-- | synapse/http/matrixfederationclient.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py index 6fd75fd381..b78cf2bafb 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py @@ -464,6 +464,8 @@ class MatrixFederationHttpClient: self.max_long_retries = hs.config.federation.max_long_retries self.max_short_retries = hs.config.federation.max_short_retries + self.max_download_size = hs.config.media.max_upload_size + self._cooperator = Cooperator(scheduler=_make_scheduler(self.reactor)) self._sleeper = AwakenableSleeper(self.reactor) @@ -1756,8 +1758,10 @@ class MatrixFederationHttpClient: request.destination, str_url, ) + # We don't know how large the response upfront, so limit it to + # the `max_upload_size` config value. length, headers, _, _ = await self._simple_http_client.get_file( - str_url, output_stream, expected_size + str_url, output_stream, self.max_download_size ) logger.info( |