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 <rep...@bugs.python.org>
<http://bugs.python.org/issue24291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to