]> granicus.if.org Git - python/commitdiff
Patch #1966: Break infinite loop in httplib when the servers
authorMartin v. Löwis <martin@v.loewis.de>
Tue, 12 Feb 2008 18:47:34 +0000 (18:47 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Tue, 12 Feb 2008 18:47:34 +0000 (18:47 +0000)
implements the chunked encoding incorrectly.
Will backport to 2.5.

Lib/httplib.py
Misc/NEWS

index d4ea2683c0ef1a8d02f7531d19f83e8594f7b076..6d27d24466ac8864f9cbac3050c08536e7e74831 100644 (file)
@@ -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
 
index 4b777367c682bf71f65658b66ff9e00a3ebb2527..d996f4884202b001f40d51f7f8a8c1e1df2443cf 100644 (file)
--- 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.