summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-01-07 14:34:00 +0000
committerErik Johnston <erik@matrix.org>2015-01-07 14:34:00 +0000
commitbacaa215eb2e1c11e50bbc3fb0e43e28a463458b (patch)
tree27510a6358b8bc219ccd456622b963a3b394bee3 /synapse/http/client.py
parentMerge branch 'hotfixes-v0.6.0a' (diff)
parentImprove change log (diff)
downloadsynapse-bacaa215eb2e1c11e50bbc3fb0e43e28a463458b.tar.xz
Merge branch 'release-v0.6.1' of github.com:matrix-org/synapse v0.6.1
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r--synapse/http/client.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 048a428905..e5d4939e2d 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright 2014 OpenMarket Ltd
+# Copyright 2014, 2015 OpenMarket Ltd
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -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,
             })
         )