Beispiel #1
0
def faccept(sslsock, sockwrapper):
    while True:
        e = excbug.iowrap(sslsock._sock.accept)
        if not isinstance(e, IOError):
            break
        assert e.errno == errno.EAGAIN
        handle_bug_eagain(sslsock.fileno(), 0)
    asock, addr = e
    asslsock = bugsub(
        sockwrapper(asock),
        keyfile=sslsock.keyfile,
        certfile=sslsock.certfile,
        server_side=True,
        cert_reqs=sslsock.cert_reqs,
        ssl_version=sslsock.ssl_version,
        ca_certs=sslsock.ca_certs,
        do_handshake_on_connect=False,
        suppress_ragged_eofs=sslsock.suppress_ragged_eofs)
    if sslsock.do_handshake_on_connect:
        asslsock.sslsock.do_handshake_on_connect = True
        while 1:
            try:
                asslsock.sslsock._sslobj.do_handshake()
                break
            except ssl.SSLError, e:
                if e.errno == ssl.SSL_ERROR_WANT_READ:
                    handle_bug_eagain(asslsock.sslsock.fileno(), 0)
                elif e.errno == ssl.SSL_ERROR_WANT_WRITE:
                    handle_bug_eagain(asslsock.sslsock.fileno(), 1)
                else:
                    raise
Beispiel #2
0
def hrecv(sslsock, buflen):
    while 1:
        e = excbug.iowrap(sslsock._sslobj.read)
        if not isinstance(e, IOError):
            return e
        assert isinstance(e, ssl.SSLError)
        if e.args[0] == ssl.SSL_ERROR_WANT_READ:
            handle_bug_eagain(sslsock.fileno(), 0)
        elif e.args[0] == ssl.SSL_ERROR_WANT_WRITE:
            handle_bug_eagain(sslsock.fileno(), 1)
        else:
            assert 0
Beispiel #3
0
def iowrap(f):
  try:
    return excbug.iowrap(f)
  except IOError, e:
    return e
Beispiel #4
0
def iowrap(f):
    try:
        return excbug.iowrap(f)
    except IOError, e:
        return e