Mercurial > hg
changeset 18345:590056e0ec2f
hgweb: send Content-Length 0 for zero length response
Before, Content-Length wasn't sent for 0 length responses. Now it is.
This could in principle prevent some unnecessary http connection close.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 15 Jan 2013 01:05:12 +0100 |
parents | 87923db0ecff |
children | 6c2563b2c1c6 |
files | mercurial/hgweb/request.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/request.py Tue Jan 15 01:05:12 2013 +0100 +++ b/mercurial/hgweb/request.py Tue Jan 15 01:05:12 2013 +0100 @@ -70,7 +70,7 @@ for s in util.filechunkiter(self.inp, limit=length): pass - def respond(self, status, type=None, filename=None, length=0): + def respond(self, status, type=None, filename=None, length=None): if self._start_response is not None: self.httphdr(type, filename, length) @@ -125,7 +125,7 @@ def header(self, headers=[('Content-Type','text/html')]): self.headers.extend(headers) - def httphdr(self, type=None, filename=None, length=0, headers={}): + def httphdr(self, type=None, filename=None, length=None, headers={}): headers = headers.items() if type is not None: headers.append(('Content-Type', type)) @@ -134,7 +134,7 @@ .replace('\\', '\\\\').replace('"', '\\"')) headers.append(('Content-Disposition', 'inline; filename="%s"' % filename)) - if length: + if length is not None: headers.append(('Content-Length', str(length))) self.header(headers)