# HG changeset patch # User Mads Kiilerich # Date 1358208312 -3600 # Node ID 6c2563b2c1c6a2d92a6bb712be2e04c345a2a1d6 # Parent 590056e0ec2f32106ea174da915d4de534fc4a2c hgweb: use Content-Length for pushres This prevents some unnecessary http connection close. diff -r 590056e0ec2f -r 6c2563b2c1c6 mercurial/hgweb/protocol.py --- a/mercurial/hgweb/protocol.py Tue Jan 15 01:05:12 2013 +0100 +++ b/mercurial/hgweb/protocol.py Tue Jan 15 01:05:12 2013 +0100 @@ -82,8 +82,9 @@ return rsp.gen elif isinstance(rsp, wireproto.pushres): val = p.restore() - req.respond(HTTP_OK, HGTYPE) - return ['%d\n%s' % (rsp.res, val)] + rsp = '%d\n%s' % (rsp.res, val) + req.respond(HTTP_OK, HGTYPE, length=len(rsp)) + return [rsp] elif isinstance(rsp, wireproto.pusherr): # drain the incoming bundle req.drain() diff -r 590056e0ec2f -r 6c2563b2c1c6 tests/test-push-cgi.t --- a/tests/test-push-cgi.t Tue Jan 15 01:05:12 2013 +0100 +++ b/tests/test-push-cgi.t Tue Jan 15 01:05:12 2013 +0100 @@ -54,6 +54,7 @@ $ cat page2 Status: 200 Script output follows\r (esc) Content-Type: application/mercurial-0.1\r (esc) + Content-Length: 102\r (esc) \r (esc) 1 adding changesets @@ -68,6 +69,7 @@ $ cat page3 Status: 200 Script output follows\r (esc) Content-Type: application/mercurial-0.1\r (esc) + Content-Length: 102\r (esc) \r (esc) 1 adding changesets @@ -82,6 +84,7 @@ $ cat page4 Status: 200 Script output follows\r (esc) Content-Type: application/mercurial-0.1\r (esc) + Content-Length: 102\r (esc) \r (esc) 1 adding changesets