changeset 31488:766364caae14

httpconnection: make sure to clear progress of httpsendfile at EOF read() should never raise EOFError. If it did, UnboundLocalError would occur due to unassigned 'ret' variable. This issue was originally reported to TortoiseHg: https://bitbucket.org/tortoisehg/thg/issues/4707/
author Yuya Nishihara <yuya@tcha.org>
date Sat, 18 Mar 2017 16:02:14 +0900
parents a992caaf0e22
children 5b2e1689b24d
files mercurial/httpconnection.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httpconnection.py	Tue Mar 14 18:23:59 2017 +0900
+++ b/mercurial/httpconnection.py	Sat Mar 18 16:02:14 2017 +0900
@@ -44,10 +44,10 @@
         self._total = self.length // 1024 * 2
 
     def read(self, *args, **kwargs):
-        try:
-            ret = self._data.read(*args, **kwargs)
-        except EOFError:
+        ret = self._data.read(*args, **kwargs)
+        if not ret:
             self.ui.progress(_('sending'), None)
+            return ret
         self._pos += len(ret)
         # We pass double the max for total because we currently have
         # to send the bundle twice in the case of a server that