Added size parameter to wsgi.py's readline to be compatible with webob.
This commit is contained in:
3
AUTHORS
3
AUTHORS
@@ -26,4 +26,5 @@ Thanks To
|
||||
* Marcus Cavanaugh, for test case code that has been incredibly useful in tracking down bugs
|
||||
* Brian Brunswick, for many helpful questions and suggestions on the mailing list
|
||||
* Cesar Alaniz, for uncovering bugs of great import
|
||||
* the grugq, for contributing patches, suggestions, and use cases
|
||||
* the grugq, for contributing patches, suggestions, and use cases
|
||||
* Ralf Schmitt, for wsgi/webob incompatibility bug report and suggested fix
|
@@ -107,7 +107,7 @@ class Input(object):
|
||||
return self._chunked_read(self.rfile, length)
|
||||
return self._do_read(self.rfile.read, length)
|
||||
|
||||
def readline(self):
|
||||
def readline(self, size=None):
|
||||
return self._do_read(self.rfile.readline)
|
||||
|
||||
def readlines(self, hint=None):
|
||||
|
@@ -404,7 +404,27 @@ class TestHttpd(LimitedTestCase):
|
||||
fd.write('GET / HTTP/1.0\r\nHost: localhost\r\nConnection: keep-alive\r\n\r\n')
|
||||
self.assert_('connection: keep-alive' in
|
||||
fd.readuntil('\r\n\r\n').lower())
|
||||
|
||||
|
||||
def test_019_fieldstorage_compat(self):
|
||||
def use_fieldstorage(environ, start_response):
|
||||
import cgi
|
||||
fs = cgi.FieldStorage(fp=environ['wsgi.input'],
|
||||
environ=environ)
|
||||
start_response('200 OK', [('Content-type', 'text/plain')])
|
||||
return ['hello!']
|
||||
|
||||
self.site.application = use_fieldstorage
|
||||
sock = api.connect_tcp(
|
||||
('localhost', self.port))
|
||||
|
||||
fd = sock.makeGreenFile()
|
||||
fd.write('POST / HTTP/1.1\r\n'
|
||||
'Host: localhost\r\n'
|
||||
'Connection: close\r\n'
|
||||
'Transfer-Encoding: chunked\r\n\r\n'
|
||||
'2\r\noh\r\n'
|
||||
'4\r\n hai\r\n0\r\n\r\n')
|
||||
self.assert_('hello!' in fd.read())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Reference in New Issue
Block a user