From dad88dc15909843f1a9caf3edd9d0fb61f1ee0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Tue, 12 Feb 2008 18:47:34 +0000 Subject: [PATCH] Patch #1966: Break infinite loop in httplib when the servers implements the chunked encoding incorrectly. Will backport to 2.5. --- Lib/httplib.py | 4 ++++ Misc/NEWS | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Lib/httplib.py b/Lib/httplib.py index d4ea2683c0e..6d27d24466a 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -573,6 +573,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 4b777367c68..d996f488420 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -400,6 +400,9 @@ Core and builtins Library ------- +- Patch #1966: Break infinite loop in httplib when the servers + implements the chunked encoding incorrectly. + - Rename rational.py to fractions.py and the rational.Rational class to fractions.Fraction, to avoid the name clash with the abstract base class numbers.Rational. See discussion in issue #1682.