diff --git a/Lib/http/client.py b/Lib/http/client.py index 745b999942bc99..6828f146a7c353 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -715,6 +715,9 @@ def _tunnel(self): line = response.fp.readline(_MAXLINE + 1) if len(line) > _MAXLINE: raise LineTooLong("header line") + if not line: + # for sites which EOF without sending a trailer + break if line == b'\r\n': break