summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-18 16:51:33 +0000
committerErik Johnston <erik@matrix.org>2015-02-18 16:52:04 +0000
commit5358966a878aa543659c10be09f4bf58b1568f2f (patch)
tree897422094208a187103a5d26e7e386d6cddf85e0 /synapse/http/client.py
parentWhen computing git version run git commands in same dir as source files (diff)
downloadsynapse-5358966a878aa543659c10be09f4bf58b1568f2f.tar.xz
Use git aware version string in User-Agent and Server headers
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r--synapse/http/client.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index e46e7db146..22b7145ac1 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -14,7 +14,6 @@
 # limitations under the License.
 
 from synapse.api.errors import CodeMessageException
-from synapse.http.agent_name import AGENT_NAME
 from syutil.jsonutil import encode_canonical_json
 
 from twisted.internet import defer, reactor
@@ -44,6 +43,7 @@ class SimpleHttpClient(object):
         # BrowserLikePolicyForHTTPS which will do regular cert validation
         # 'like a browser'
         self.agent = Agent(reactor)
+        self.version_string = hs.version_string
 
     @defer.inlineCallbacks
     def post_urlencoded_get_json(self, uri, args={}):
@@ -55,7 +55,7 @@ class SimpleHttpClient(object):
             uri.encode("ascii"),
             headers=Headers({
                 b"Content-Type": [b"application/x-www-form-urlencoded"],
-                b"User-Agent": [AGENT_NAME],
+                b"User-Agent": [self.version_string],
             }),
             bodyProducer=FileBodyProducer(StringIO(query_bytes))
         )
@@ -108,7 +108,7 @@ class SimpleHttpClient(object):
             "GET",
             uri.encode("ascii"),
             headers=Headers({
-                b"User-Agent": [AGENT_NAME],
+                b"User-Agent": [self.version_string],
             })
         )
 
@@ -149,7 +149,7 @@ class SimpleHttpClient(object):
             "PUT",
             uri.encode("ascii"),
             headers=Headers({
-                b"User-Agent": [AGENT_NAME],
+                b"User-Agent": [self.version_string],
                 "Content-Type": ["application/json"]
             }),
             bodyProducer=FileBodyProducer(StringIO(json_str))
@@ -182,7 +182,7 @@ class CaptchaServerHttpClient(SimpleHttpClient):
             bodyProducer=FileBodyProducer(StringIO(query_bytes)),
             headers=Headers({
                 b"Content-Type": [b"application/x-www-form-urlencoded"],
-                b"User-Agent": [AGENT_NAME],
+                b"User-Agent": [self.version_string],
             })
         )