]> 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:48:23 +0000 (18:48 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Tue, 12 Feb 2008 18:48:23 +0000 (18:48 +0000)
implements the chunked encoding incorrectly.

Lib/httplib.py
Misc/NEWS

index 403e4eed005947a734bf35133f550ca26d36575e..137a9eaa8a637d2a43c48c4f062efe83ce0fd442 100644 (file)
@@ -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
 
index ffb1771ff5c774547f0a35188cb452a93cdbc355..6ea4eeaec33fbc53099027c9f7417aa1e40a45c8 100644 (file)
--- 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