[issue24291] wsgiref.handlers.SimpleHandler truncates large output blobs

2015-05-26 Thread Jonathan Kamens

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



[issue24292] wsgiref.simple_server.WSGIRequestHandler doesn't log request timeouts

2015-05-26 Thread Jonathan Kamens

New submission from Jonathan Kamens:

http.BaseHTTPRequestHandler logs request timeouts. In handle_one_request():

except socket.timeout as e:
#a read or a write timed out.  Discard this connection
self.log_error("Request timed out: %r", e)
self.close_connection = 1
return

Unfortunately, wsgiref.simple_server.WSGIRequestHandler, which overrides 
BaseHTTPRequestHandler's handle() method, does _not_ catch and log request 
timeouts. Fixing this is a simple matter of wrapping the entire body of its 
handle() function in a try with this except clause:

except socket.timeout as e:
self.log_error("Request timed out: %r", e)
raise

--
components: Library (Lib)
messages: 244134
nosy: Jonathan Kamens
priority: normal
severity: normal
status: open
title: wsgiref.simple_server.WSGIRequestHandler doesn't log request timeouts
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 
<http://bugs.python.org/issue24292>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26313] ssl.py _load_windows_store_certs fails if windows cert store is empty

2016-02-08 Thread Jonathan Kamens

New submission from Jonathan Kamens:

In ssl.py:

def _load_windows_store_certs(self, storename, purpose):
certs = bytearray()
for cert, encoding, trust in enum_certificates(storename):
# CA certs are never PKCS#7 encoded 
if encoding == "x509_asn":
if trust is True or purpose.oid in trust:
certs.extend(cert)
self.load_verify_locations(cadata=certs)
return certs

The line right before the return statement will raise an exception if certs is 
empty.

It should be protected with "if certs:" as it is elsewhere in this file.

--
components: Windows
messages: 259880
nosy: Jonathan Kamens, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: ssl.py _load_windows_store_certs fails if windows cert store is empty
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue26313>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com