changeset 18351:3fbdbeab38cc

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.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 15 Jan 2013 01:05:12 +0100
parents c0d63e1884a3
children e33b9b92a200
files mercurial/hgweb/request.py
diffstat 1 files changed, 6 insertions(+), 5 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
@@ -105,11 +105,12 @@
             self.headers = []
 
     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: