benoitc/gunicorn — pull request #362 by sirkonst (2012-06-01 12:35:09+00:00)
Title: IOError for chunk's exceptions

If remote client send invalid data in request with "Transfer-Encoding:chunked" gunicorn can raised some exceptions (see http.body.ChunkedReader) as NoMoreData, ChunkMissingTerminator, InvalidChunkSize.

I think the user application shouldn't know about gunicorn specific exceptions and must catch standard IOError if want.

Example:
```
def app(env, start_response):

body = env["wsgi.input"]

chunk_size = 1024

while True:
try:
chunk = body.read(chunk_size)
except IOError:
.. correct action for error

if not chunk:
break

.. do somethink with chunk
```

What do you think?