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 pitrou
Recipients pitrou, segfaulthunter
Date 2011-02-26.00:39:53
SpamBayes Score 0.0054356307
Marked as misclassified No
Message-id <1298680794.36.0.15439781076.issue11326@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, one issue is that connect_ex() isn't implemented for SSL sockets, so it defers to the normal implementation instead, which is wrong.

But your still is wrong too. connect_ex() returns an error, meaning the socket isn't connected and you must retry. Here is a working snippet using connect():


def connect():
    try:
        s.connect(('people.csail.mit.edu', 443))
    except socket.error as e:
        if e.errno != errno.EINPROGRESS:
            raise
        return False
    else:
        return True

while not connect():
    select.select([s], [s], [])

while True:
    try:
        select.select([s], [s], [])
        s.do_handshake()
        break
    except ssl.SSLError as err:
        if err.args[0] == ssl.SSL_ERROR_WANT_READ:
            select.select([s], [], [])
        elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:
            select.select([], [s], [])
        else:
            raise
History
Date User Action Args
2011-02-26 00:39:54pitrousetrecipients: + pitrou, segfaulthunter
2011-02-26 00:39:54pitrousetmessageid: <1298680794.36.0.15439781076.issue11326@psf.upfronthosting.co.za>
2011-02-26 00:39:53pitroulinkissue11326 messages
2011-02-26 00:39:53pitroucreate