http: report unexpected unparsable push responses (issue2777)
authorMatt Mackall <mpm@selenic.com>
Thu, 16 Jun 2011 13:24:42 -0500
changeset 14641 f2789767a2c4
parent 14640 406b6d7bdcb9
child 14642 fdcdb221a922
http: report unexpected unparsable push responses (issue2777)
mercurial/httprepo.py
--- a/mercurial/httprepo.py	Tue Jun 07 13:39:09 2011 +0300
+++ b/mercurial/httprepo.py	Thu Jun 16 13:24:42 2011 -0500
@@ -191,7 +191,10 @@
         try:
             try:
                 r = self._call(cmd, data=fp, headers=headers, **args)
-                return r.split('\n', 1)
+                vals = r.split('\n', 1)
+                if len(vals) < 2:
+                    raise error.ResponseError(_("unexpected response:"), d)
+                return vals
             except socket.error, err:
                 if err.args[0] in (errno.ECONNRESET, errno.EPIPE):
                     raise util.Abort(_('push failed: %s') % err.args[1])