This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author matejcik
Recipients matejcik
Date 2008-09-19.17:49:33
SpamBayes Score 1.6335744e-05
Marked as misclassified No
Message-id <1221846575.92.0.833754739866.issue3910@psf.upfronthosting.co.za>
In-reply-to
Content
python 2.6's compatibility socket.ssl() method does not handle 'sock'
parameter in the same way.

in 2.5, ssl() looked like this:

def ssl(sock, keyfile=None, certfile=None):
    if hasattr(sock, "_sock"):
        sock = sock._sock
    return _realssl(sock, keyfile, certfile)

in 2.6 the call is handed to ssl.sslwrap_simple, which then blindly does
_ssl.sslwrap(sock._sock, 0, keyfile, certfile, CERT_NONE,
PROTOCOL_SSLv23, None)
instead of checking whether the sock is the socket itself or the socket
object.
This causes code that passes the socket directly to fail with
"AttributeError: '_socket.socket' object has no attribute '_sock'
"

the attached patch fixes the behavior.
History
Date User Action Args
2008-09-19 17:49:36matejciksetrecipients: + matejcik
2008-09-19 17:49:35matejciksetmessageid: <1221846575.92.0.833754739866.issue3910@psf.upfronthosting.co.za>
2008-09-19 17:49:35matejciklinkissue3910 messages
2008-09-19 17:49:34matejcikcreate