Don't use default value in LimitingReader

We can't simply pass the None default on to the read operation as this
default is handled differently between different wsgi implementations.

Change-Id: I337e797b8dee3dfcf9299fe361cf197a176c8fe2
Fixes: bug 1213106
This commit is contained in:
Jamie Lennox
2013-10-09 11:49:58 +10:00
parent df0a963425
commit 12fd2aa500
2 changed files with 29 additions and 1 deletions

View File

@@ -290,7 +290,12 @@ class LimitingReader(object):
yield chunk
def read(self, i=None):
result = self.data.read(i)
# NOTE(jamielennox): We can't simply provide the default to the read()
# call as the expected default differs between mod_wsgi and eventlet
if i is None:
result = self.data.read()
else:
result = self.data.read(i)
self.bytes_read += len(result)
if self.bytes_read > self.limit:
raise exception.RequestTooLarge()