]> granicus.if.org Git - python/commitdiff
Patch #817854: Add missing operations for SSLFile. Fixes #792101.
authorMartin v. Löwis <martin@v.loewis.de>
Mon, 27 Oct 2003 14:07:53 +0000 (14:07 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Mon, 27 Oct 2003 14:07:53 +0000 (14:07 +0000)
Backported to 2.3.

Lib/httplib.py

index 03adb43604bfc8791cbc241527ae94c1d435b571..9832e474f834cc66ab6e62eb95b70f62e0b767f9 100644 (file)
@@ -910,6 +910,31 @@ class SSLFile(SharedSocketClient):
             self._buf = all[i:]
             return line
 
+    def readlines(self, sizehint=0):
+        total = 0
+        list = []
+        while True:
+            line = self.readline()
+            if not line:
+                break
+            list.append(line)
+            total += len(line)
+            if sizehint and total >= sizehint:
+                break
+        return list
+
+    def fileno(self):
+        return self._sock.fileno()
+
+    def __iter__(self):
+        return self
+
+    def next(self):
+        line = self.readline()
+        if not line:
+            raise StopIteration
+        return line
+
 class FakeSocket(SharedSocketClient):
 
     class _closedsocket: