Merge branch 'master' into python3
[wrw.git] / wrw / sp / util.py
index ad99e8b..0728a7e 100644 (file)
@@ -235,5 +235,7 @@ class response(dispatch.restart):
         raise Exception("a subclass of wrw.sp.util.response must override ctype")
 
     def handle(self, req):
+        ret = self.formatter.format(self.root, doctype=self.doctype, charset=self.charset)
         req.ohead["Content-Type"] = self.ctype
-        return [self.formatter.format(self.root, doctype=self.doctype, charset=self.charset)]
+        req.ohead["Content-Length"] = len(ret)
+        return [ret]