summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-01-06 10:53:04 +0000
committerErik Johnston <erik@matrix.org>2015-01-06 10:53:04 +0000
commit96a5ba41f503982dfa8b7d669161ea43b0529189 (patch)
tree4ad40ec4cac09fd67b01cd10ce6f99e295953b72 /synapse/http/client.py
parentMerge branch 'master' of github.com:matrix-org/synapse into erikj-perf (diff)
parentspell out that VoIP needs TURN (diff)
downloadsynapse-96a5ba41f503982dfa8b7d669161ea43b0529189.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj-perf
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r--synapse/http/client.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 048a428905..11d6d9cb2c 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 
+from synapse.http.agent_name import AGENT_NAME
 from twisted.internet import defer, reactor
 from twisted.web.client import (
     Agent, readBody, FileBodyProducer, PartialDownloadError
@@ -51,7 +52,8 @@ class SimpleHttpClient(object):
             "POST",
             uri.encode("ascii"),
             headers=Headers({
-                "Content-Type": ["application/x-www-form-urlencoded"]
+                b"Content-Type": [b"application/x-www-form-urlencoded"],
+                b"User-Agent": AGENT_NAME,
             }),
             bodyProducer=FileBodyProducer(StringIO(query_bytes))
         )
@@ -86,6 +88,9 @@ class SimpleHttpClient(object):
         response = yield self.agent.request(
             "GET",
             uri.encode("ascii"),
+            headers=Headers({
+                b"User-Agent": AGENT_NAME,
+            })
         )
 
         body = yield readBody(response)
@@ -108,7 +113,8 @@ class CaptchaServerHttpClient(SimpleHttpClient):
             url.encode("ascii"),
             bodyProducer=FileBodyProducer(StringIO(query_bytes)),
             headers=Headers({
-                "Content-Type": ["application/x-www-form-urlencoded"]
+                b"Content-Type": [b"application/x-www-form-urlencoded"],
+                b"User-Agent": AGENT_NAME,
             })
         )