From: Fredrik Tolf Date: Wed, 5 Jun 2013 10:58:54 +0000 (+0200) Subject: Merge branch 'python3' of git.dolda2000.com:/srv/git/r/wrw into python3 X-Git-Url: http://dolda2000.com/gitweb/?p=wrw.git;a=commitdiff_plain;h=a9a78095b1696f56946abfc7c284f86a21fdcc2d;hp=-c Merge branch 'python3' of git.dolda2000.com:/srv/git/r/wrw into python3 --- a9a78095b1696f56946abfc7c284f86a21fdcc2d diff --combined wrw/resp.py index bdceb90,69635f8..ebd98ec --- a/wrw/resp.py +++ b/wrw/resp.py @@@ -70,5 -70,10 +70,11 @@@ 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): + def handle(self, req): + req.status(304, "Not Modified") + req.ohead["Content-Length"] = "0" + return [] diff --combined wrw/sp/xhtml.py index 52e7f9f,662c171..5f1ca45 --- a/wrw/sp/xhtml.py +++ b/wrw/sp/xhtml.py @@@ -53,11 -53,10 +53,12 @@@ 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): return forreq(req, callable(req)) + wrapper.__wrapped__ = callable return wrapper