Empty chunks incorrectly signal end of response.

If an app iterator attempts to send an empty string to the client
while using chunked transfer encoding it incorrectly signals the
end of the transfer. This patch just ignores empty strings that
are yielded by the application.
This commit is contained in:
Paul J. Davis 2011-04-27 13:26:40 -04:00 committed by benoitc
parent c71b9a88c2
commit d83c63429e

View File

@ -244,6 +244,11 @@ class Response(object):
if tosend < arglen:
arg = arg[:tosend]
# Sending an empty chunk signals the end of the
# response and prematurely closes the response
if self.chunked and tosend == 0:
return
self.sent += tosend
util.write(self.sock, arg, self.chunked)