Patch #1966: Break infinite loop in httplib when the servers
implements the chunked encoding incorrectly.
Will backport to 2.5.
diff --git a/Lib/httplib.py b/Lib/httplib.py
index d4ea268..6d27d24 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -573,6 +573,10 @@
         ### 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 4b77736..d996f48 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -400,6 +400,9 @@
 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.