From 773de09774399692cb43d56587ae77cbbee42d01 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 6 Jan 2015 13:05:07 +0000 Subject: [PATCH] Set a content-length for JSON responses --- synapse/http/server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/synapse/http/server.py b/synapse/http/server.py index 5765dffe39..de26afb48a 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py @@ -233,6 +233,7 @@ 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", "*")