Merge branch 'python3' of git.dolda2000.com:/srv/git/r/wrw into python3
authorFredrik Tolf <fredrik@dolda2000.com>
Wed, 5 Jun 2013 10:58:54 +0000 (12:58 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Wed, 5 Jun 2013 10:58:54 +0000 (12:58 +0200)
wrw/resp.py
wrw/sp/xhtml.py

index 69635f8..ebd98ec 100644 (file)
@@ -70,6 +70,7 @@ 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 []
 
 class unmodified(dispatch.restart):
index 662c171..5f1ca45 100644 (file)
@@ -53,7 +53,9 @@ def forreq(req, tree):
     req.ohead["Content-Type"] = "text/html; charset=utf-8"
     buf = io.BytesIO()
     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):