Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/protocol.py @ 18352:e33b9b92a200
hgweb: pass the actual response body to request.response, not just the length
This makes it less likely to send a response that doesn't match Content-Length.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 15 Jan 2013 01:07:03 +0100 |
parents | 6c2563b2c1c6 |
children | 8d477543882b |
line wrap: on
line diff
--- a/mercurial/hgweb/protocol.py Tue Jan 15 01:05:12 2013 +0100 +++ b/mercurial/hgweb/protocol.py Tue Jan 15 01:07:03 2013 +0100 @@ -75,24 +75,24 @@ p = webproto(req, repo.ui) rsp = wireproto.dispatch(repo, p, cmd) if isinstance(rsp, str): - req.respond(HTTP_OK, HGTYPE, length=len(rsp)) - return [rsp] + req.respond(HTTP_OK, HGTYPE, body=rsp) + return [] elif isinstance(rsp, wireproto.streamres): req.respond(HTTP_OK, HGTYPE) return rsp.gen elif isinstance(rsp, wireproto.pushres): val = p.restore() rsp = '%d\n%s' % (rsp.res, val) - req.respond(HTTP_OK, HGTYPE, length=len(rsp)) - return [rsp] + req.respond(HTTP_OK, HGTYPE, body=rsp) + return [] elif isinstance(rsp, wireproto.pusherr): # drain the incoming bundle req.drain() p.restore() rsp = '0\n%s\n' % rsp.res - req.respond(HTTP_OK, HGTYPE, length=len(rsp)) - return [rsp] + req.respond(HTTP_OK, HGTYPE, body=rsp) + return [] elif isinstance(rsp, wireproto.ooberror): rsp = rsp.message - req.respond(HTTP_OK, HGERRTYPE, length=len(rsp)) - return [rsp] + req.respond(HTTP_OK, HGERRTYPE, body=rsp) + return []