From d85851bccacfade385faeba60d3d0daba3087c93 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 30 Nov 2018 14:39:26 +0000 Subject: Fix fetching media when using proxy --- synapse/http/matrixfederationclient.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'synapse') diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py index ef5c71996c..211b800e9e 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py @@ -213,6 +213,15 @@ class MatrixFederationHttpClient(object): self.agent = Agent.usingEndpointFactory( reactor, MatrixFederationEndpointFactory(hs), pool=pool ) + + file_pool = HTTPConnectionPool(reactor) + file_pool.retryAutomatically = False + file_pool.maxPersistentPerHost = 5 + file_pool.cachedConnectionTimeout = 10 + + self.file_agent = Agent.usingEndpointFactory( + reactor, MatrixFederationEndpointFactory(hs), pool=file_pool + ) self.clock = hs.get_clock() self._store = hs.get_datastore() self.version_string_bytes = hs.version_string.encode('ascii') @@ -231,7 +240,8 @@ class MatrixFederationHttpClient(object): timeout=None, long_retries=False, ignore_backoff=False, - backoff_on_404=False + backoff_on_404=False, + agent=None, ): """ Sends a request to the given server. @@ -724,6 +734,7 @@ class MatrixFederationHttpClient(object): request, retry_on_dns_fail=retry_on_dns_fail, ignore_backoff=ignore_backoff, + agent=self.file_agent, ) headers = dict(response.headers.getAllRawHeaders()) -- cgit 1.5.1