hgweb: don't pass empty response chunks on
authorMads Kiilerich <mads@kiilerich.com>
Tue, 15 Jan 2013 01:05:12 +0100
changeset 18351 3fbdbeab38cc
parent 18350 c0d63e1884a3
child 18352 e33b9b92a200
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.
mercurial/hgweb/request.py
--- 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: