From: Martin v. Löwis Date: Mon, 27 Oct 2003 14:07:53 +0000 (+0000) Subject: Patch #817854: Add missing operations for SSLFile. Fixes #792101. X-Git-Tag: v2.4a1~1361 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11892ecd6dcf8714aa19b9f09c1cbcaa235e2743;p=python Patch #817854: Add missing operations for SSLFile. Fixes #792101. Backported to 2.3. --- diff --git a/Lib/httplib.py b/Lib/httplib.py index 03adb43604..9832e474f8 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -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: