Fix for Issue13684 - httplib tunnel infinite loop
authorSenthil Kumaran <senthil@uthcode.com>
Mon, 23 Apr 2012 15:46:46 +0000 (23:46 +0800)
committerSenthil Kumaran <senthil@uthcode.com>
Mon, 23 Apr 2012 15:46:46 +0000 (23:46 +0800)
Lib/httplib.py

index 13629c4a965a27679e88467848450fda9fe91279..5d16e53c4c393b7c61c0438537af64dafe78dc2b 100644 (file)
@@ -748,7 +748,11 @@ class HTTPConnection:
             line = response.fp.readline(_MAXLINE + 1)
             if len(line) > _MAXLINE:
                 raise LineTooLong("header line")
-            if line == '\r\n': break
+            if not line:
+                # for sites which EOF without sending trailer
+                break
+            if line == '\r\n':
+                break
 
 
     def connect(self):