diff mercurial/httprepo.py @ 14641:f2789767a2c4

http: report unexpected unparsable push responses (issue2777)
author Matt Mackall <mpm@selenic.com>
date Thu, 16 Jun 2011 13:24:42 -0500
parents 4f695345979c
children ba3c36cea66e
line wrap: on
line diff
--- 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])