Pull requests

#5 Declined
Repository
kcor kcor
Branch
default
Repository
cherrypy cherrypy
Branch
default

Close response iterator, fix chunked request handling

Author
  1. kcor
Reviewers
Description

I couldn't figure out how to separate the pull requests, so there are two sets of changes here.

_cpwsgi.py:

When a client cancels a streaming response, the iterator can hang around, which causes problems in my application. This change closes an iterator when the response is closed.

wsgiserver2.py:

Firslty, ChunkedRFile.read() can go into an infinite loop when the default size=None argument is used. Secondly, the remaining message body for chunked requests is not read out like it is for regular requests. The server will then treat leftover chunks as new requests and send 400 Bad Request responses. This change fixes those so chunked requests are handled in the same manner as regular requests.

Comments (0)