diff options
author | Erik Johnston <erik@matrix.org> | 2015-01-07 14:34:00 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-01-07 14:34:00 +0000 |
commit | bacaa215eb2e1c11e50bbc3fb0e43e28a463458b (patch) | |
tree | 27510a6358b8bc219ccd456622b963a3b394bee3 /synapse/http/server.py | |
parent | Merge branch 'hotfixes-v0.6.0a' (diff) | |
parent | Improve change log (diff) | |
download | synapse-bacaa215eb2e1c11e50bbc3fb0e43e28a463458b.tar.xz |
Merge branch 'release-v0.6.1' of github.com:matrix-org/synapse v0.6.1
Diffstat (limited to 'synapse/http/server.py')
-rw-r--r-- | synapse/http/server.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py index f33859cf76..8015a22edf 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.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,14 +14,16 @@ # limitations under the License. -from syutil.jsonutil import ( - encode_canonical_json, encode_pretty_printed_json -) +from synapse.http.agent_name import AGENT_NAME from synapse.api.errors import ( cs_exception, SynapseError, CodeMessageException ) from synapse.util.logcontext import LoggingContext +from syutil.jsonutil import ( + encode_canonical_json, encode_pretty_printed_json +) + from twisted.internet import defer, reactor from twisted.web import server, resource from twisted.web.server import NOT_DONE_YET @@ -230,6 +232,8 @@ def respond_with_json_bytes(request, code, json_bytes, send_cors=False, request.setResponseCode(code, message=response_code_message) request.setHeader(b"Content-Type", b"application/json") + request.setHeader(b"Server", AGENT_NAME) + request.setHeader(b"Content-Length", b"%d" % (len(json_bytes),)) if send_cors: request.setHeader("Access-Control-Allow-Origin", "*") |