summary refs log tree commit diff
path: root/synapse/http/federation
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-01-25 14:11:17 +0000
committerErik Johnston <erik@matrix.org>2019-01-25 14:11:17 +0000
commit431e485914b01eb1b245e37df814ff5bac110be1 (patch)
tree1262900b08616aa08768d9883349b11725218528 /synapse/http/federation
parentNewsfile (diff)
parentFix quoting for allowed_local_3pids example config (#4476) (diff)
downloadsynapse-431e485914b01eb1b245e37df814ff5bac110be1.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/sqlite_native_upsert
Diffstat (limited to 'synapse/http/federation')
-rw-r--r--synapse/http/federation/matrix_federation_agent.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/http/federation/matrix_federation_agent.py b/synapse/http/federation/matrix_federation_agent.py

index 0ec28c6696..1788e9a34a 100644 --- a/synapse/http/federation/matrix_federation_agent.py +++ b/synapse/http/federation/matrix_federation_agent.py
@@ -19,6 +19,7 @@ from zope.interface import implementer from twisted.internet import defer from twisted.internet.endpoints import HostnameEndpoint, wrapClientTLS from twisted.web.client import URI, Agent, HTTPConnectionPool +from twisted.web.http_headers import Headers from twisted.web.iweb import IAgent from synapse.http.endpoint import parse_server_name @@ -109,6 +110,15 @@ class MatrixFederationAgent(object): else: target = pick_server_from_list(server_list) + # make sure that the Host header is set correctly + if headers is None: + headers = Headers() + else: + headers = headers.copy() + + if not headers.hasHeader(b'host'): + headers.addRawHeader(b'host', server_name_bytes) + class EndpointFactory(object): @staticmethod def endpointForURI(_uri):