- if not self.environ['eventlet.input'].wfile:
- # NOTE: MINIMUM_CHUNK_SIZE is used here for purpose different than chunking.
- # We use it only cause it's at hand and has reasonable value in terms of
- # emptying the buffer.
- while self.environ['eventlet.input'].read(MINIMUM_CHUNK_SIZE):
- pass
+ if not request_input.wfile and self.close_connection == 0:
+ try:
+ request_input.discard()
+ except ChunkReadError as e:
+ self.close_connection = 1
+ self.server.log.error((
+ 'chunked encoding error while discarding request body.'
+ + ' ip={0} request="{1}" error="{2}"').format(
+ self.get_client_ip(), self.requestline, e,
+ ))