From a7b35f84508eb5ab8a890065275e5a0f3bc5bef5 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Wed, 5 Jun 2013 12:58:02 +0200 Subject: [PATCH] Set Content-Length in a couple of places. --- wrw/resp.py | 1 + wrw/sp/xhtml.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wrw/resp.py b/wrw/resp.py index 24896ba..a27a143 100644 --- a/wrw/resp.py +++ b/wrw/resp.py @@ -70,4 +70,5 @@ class redirect(dispatch.restart): def handle(self, req): req.status(self.status, "Redirect") req.ohead["Location"] = proto.appendurl(proto.requrl(req), self.url) + req.ohead["Content-Length"] = 0 return [] diff --git a/wrw/sp/xhtml.py b/wrw/sp/xhtml.py index 3c6c0f6..d19fc99 100644 --- a/wrw/sp/xhtml.py +++ b/wrw/sp/xhtml.py @@ -53,7 +53,9 @@ def forreq(req, tree): req.ohead["Content-Type"] = "text/html; charset=utf-8" buf = StringIO.StringIO() htmlindenter.output(buf, tree, doctype=(doctype, dtd), charset="utf-8") - return [buf.getvalue()] + ret = buf.getvalue() + req.ohead["Content-Length"] = len(ret) + return [ret] def xhtmlresp(callable): def wrapper(req): -- 2.11.0