Message174121
mcjeff@martian:~/cpython$ ./python -V
Python 3.4.0a0
When an SSLSocket is created via SSLContext.wrap_socket, it is passed a _context parameter directly. SSLSocket.__init__ sets self.context at this point, but it does not set self.keyfile or self.certfile.
However, in SSLSocket.accept, both keyfile & certfile are passed when creating a new, wrapped SSLSocket, from socket.accept's newsock.
The result is an attribute error.
>>> import ssl
>>> c = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
>>> c.load_cert_chain('Lib/test/keycert.pem')
>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
>>> s.bind(('127.0.0.1', 5050))
>>> s.listen(5)
>>> s.accept() # nc localhost 5050 in another term.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/google/home/mcjeff/cpython/Lib/ssl.py", line 557, in accept
keyfile=self.keyfile, certfile=self.certfile,
AttributeError: 'SSLSocket' object has no attribute 'keyfile'
>>>
Attached one-liner addresses it by passing in the context rather than the keyfile & certfile.
>>> s.accept()
(<socket.socket object, fd=4, family=2, type=1, proto=0>, ('127.0.0.1', 37306))
>>> |
|
Date |
User |
Action |
Args |
2012-10-29 15:53:59 | mcjeff | set | recipients:
+ mcjeff |
2012-10-29 15:53:59 | mcjeff | set | messageid: <1351526039.51.0.105215109749.issue16357@psf.upfronthosting.co.za> |
2012-10-29 15:53:59 | mcjeff | link | issue16357 messages |
2012-10-29 15:53:59 | mcjeff | create | |
|