From e9c996c14db994fb0afe806a0eee16a97b587fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Tue, 12 Feb 2008 18:48:23 +0000 Subject: Patch #1966: Break infinite loop in httplib when the servers implements the chunked encoding incorrectly. --- Lib/httplib.py | 4 ++++ Misc/NEWS | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Lib/httplib.py b/Lib/httplib.py index 403e4ee..137a9ea 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -571,6 +571,10 @@ class HTTPResponse: ### note: we shouldn't have any trailers! while True: line = self.fp.readline() + if not line: + # a vanishingly small number of sites EOF without + # sending the trailer + break if line == '\r\n': break diff --git a/Misc/NEWS b/Misc/NEWS index ffb1771..6ea4eea 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -83,6 +83,9 @@ Core and builtins Library ------- +- Patch #1966: Break infinite loop in httplib when the servers + implements the chunked encoding incorrectly. + - tarfile.py: Fix reading of xstar archives. - #2021: Allow tempfile.NamedTemporaryFile to be used in with statements -- cgit v0.12