[New-bugs-announce] [issue24291] wsgiref.handlers.SimpleHandler truncates large output blobs

Jonathan Kamens report at bugs.python.org
Tue May 26 22:18:01 CEST 2015


New submission from Jonathan Kamens:

The _write method of wsgiref.handlers.SimpleHandler reads as follows:

    def _write(self,data):
        self.stdout.write(data)

The problem here is that calling write() on a socket is not actually guaranteed to write all of the data in the buffer. If the length of data is large enough, then the kernel will take only part of it. In that case, the rest of the response data will be silently discarded by wsgiref.

_write needs to check the return value of self.stdout.write(data), and if it is less than the length of data, repeat the write from the middle of the data buffer, etc., until all the data has been written.

----------
components: Library (Lib)
messages: 244131
nosy: Jonathan Kamens
priority: normal
severity: normal
status: open
title: wsgiref.handlers.SimpleHandler truncates large output blobs
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24291>
_______________________________________


More information about the New-bugs-announce mailing list