[PATCH 10 of 12] hgweb: don't pass empty response chunks on
Mads Kiilerich
mads at kiilerich.com
Fri Jan 11 23:32:54 UTC 2013
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1357947109 -3600
# Node ID d085fef69932009da56e66d46b75da5c885cf91a
# Parent cb969323468b05ce085de63865cdd4c08fb8f994
hgweb: don't pass empty response chunks on
hgweb internals will often produce empty writes - especially when returning
compressed data. hgweb is no middleware application and there is thus no
reason to pass them on to be processed in other layers.
diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -109,11 +109,12 @@
self.server_write = None
def write(self, thing):
- try:
- self.server_write(thing)
- except socket.error, inst:
- if inst[0] != errno.ECONNRESET:
- raise
+ if thing:
+ try:
+ self.server_write(thing)
+ except socket.error, inst:
+ if inst[0] != errno.ECONNRESET:
+ raise
def writelines(self, lines):
for line in lines:
More information about the Mercurial-devel
mailing list