diff -r afcbc6f64d27 -r 9bd003052d55 mercurial/keepalive.py --- a/mercurial/keepalive.py Fri Aug 18 20:20:38 2017 -0700 +++ b/mercurial/keepalive.py Mon Sep 25 11:05:16 2017 +0200 @@ -90,6 +90,7 @@ import sys import threading +from .i18n import _ from . import ( util, ) @@ -231,6 +232,10 @@ self._cm.add(host, h, 0) self._start_transaction(h, req) r = h.getresponse() + # The string form of BadStatusLine is the status line. Add some context + # to make the error message slightly more useful. + except httplib.BadStatusLine as err: + raise urlerr.urlerror(_('bad HTTP status line: %s') % err.line) except (socket.error, httplib.HTTPException) as err: raise urlerr.urlerror(err)