diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -84,9 +84,10 @@ def _wraphttpresponse(resp): except httplib.IncompleteRead as e: # e.expected is an integer if length known or None otherwise. if e.expected: + got = len(e.partial) + total = e.expected + got msg = _('HTTP request error (incomplete response; ' - 'expected %d bytes got %d)') % (e.expected, - len(e.partial)) + 'expected %d bytes got %d)') % (total, got) else: msg = _('HTTP request error (incomplete response)') diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -275,7 +275,7 @@ Server sends an incomplete capabilities $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone - abort: HTTP request error (incomplete response; expected 416 bytes got 20) + abort: HTTP request error (incomplete response; expected 436 bytes got 20) (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) [255] @@ -600,7 +600,7 @@ Server sends partial bundle2 header magi $ hg clone http://localhost:$HGPORT/ clone requesting all changes - abort: HTTP request error (incomplete response; expected 1 bytes got 3) + abort: HTTP request error (incomplete response; expected 4 bytes got 3) (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) [255] @@ -624,7 +624,7 @@ Server sends incomplete bundle2 stream p $ hg clone http://localhost:$HGPORT/ clone requesting all changes - abort: HTTP request error (incomplete response; expected 1 bytes got 3) + abort: HTTP request error (incomplete response; expected 4 bytes got 3) (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) [255] @@ -733,7 +733,7 @@ Server stops after bundle2 part payload adding changesets transaction abort! rollback completed - abort: HTTP request error (incomplete response; expected 459 bytes got 7) + abort: HTTP request error (incomplete response; expected 466 bytes got 7) (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) [255] @@ -799,7 +799,7 @@ Server stops sending after 0 length payl added 1 changesets with 1 changes to 1 files transaction abort! rollback completed - abort: HTTP request error (incomplete response; expected 23 bytes got 9) + abort: HTTP request error (incomplete response; expected 32 bytes got 9) (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) [255]