Ticket #15018: test_and_fix_for_ticket_15018.diff
File test_and_fix_for_ticket_15018.diff, 1.5 KB (added by , 14 years ago) |
---|
-
django/core/handlers/wsgi.py
96 96 return result 97 97 98 98 def readline(self, size=None): 99 while '\n' not in self.buffer or\100 (size is not None andlen(self.buffer) < size):99 while '\n' not in self.buffer and \ 100 (size is None or len(self.buffer) < size): 101 101 if size: 102 # since size is not None here, len(self.buffer) < size 102 103 chunk = self._read_limited(size - len(self.buffer)) 103 104 else: 104 105 chunk = self._read_limited() -
tests/regressiontests/requests/tests.py
129 129 # Read everything else. 130 130 self.assertEqual(stream.readline(), 'ijkl') 131 131 132 def test_limited_stream_ticket_15018(self): 133 stream = LimitedStream(StringIO('\nabc'), 3) 134 self.assertEqual(stream.readline(3), '\n') 135 self.assertEqual(stream.readline(1), 'a') 136 self.assertEqual(stream.readline(1), 'b') 137 # Hit stream limit 138 self.assertEqual(stream.readline(1), '') 139 132 140 def test_stream(self): 133 141 request = WSGIRequest({'REQUEST_METHOD': 'POST', 'wsgi.input': StringIO('name=value')}) 134 142 self.assertEqual(request.read(), 'name=value')