diff options
author | Hye-Shik Chang <hyeshik@gmail.com> | 2004-06-05 13:30:56 (GMT) |
---|---|---|
committer | Hye-Shik Chang <hyeshik@gmail.com> | 2004-06-05 13:30:56 (GMT) |
commit | 39aef79821d9ad8d428b14b59190bd0ca0c550d9 (patch) | |
tree | 5421d50fc7b9fb7e4e30d44d61d37a2954ed891f /Lib/httplib.py | |
parent | 5962f457b48997dbfb8bcb0769b57cd3fab96148 (diff) | |
download | cpython-39aef79821d9ad8d428b14b59190bd0ca0c550d9.zip cpython-39aef79821d9ad8d428b14b59190bd0ca0c550d9.tar.gz cpython-39aef79821d9ad8d428b14b59190bd0ca0c550d9.tar.bz2 |
Fix a bug that robotparser starves memory when the server responses
in HTTP/0.9 due to dissonance of httplib.LineAndFileWrapper and
urllib.addbase.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r-- | Lib/httplib.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index 40e78b0..5133c8d 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -1181,7 +1181,9 @@ class LineAndFileWrapper: self.readlines = self._file.readlines def read(self, amt=None): - assert not self._line_consumed and self._line_left + if self._line_consumed: + return self._file.read(amt) + assert self._line_left if amt is None or amt > self._line_left: s = self._line[self._line_offset:] self._done() @@ -1201,11 +1203,17 @@ class LineAndFileWrapper: return s def readline(self): + if self._line_consumed: + return self._file.readline() + assert self._line_left s = self._line[self._line_offset:] self._done() return s def readlines(self, size=None): + if self._line_consumed: + return self._file.readlines(size) + assert self._line_left L = [self._line[self._line_offset:]] self._done() if size is None: |