--- m2crypto/M2Crypto/SSL/Connection.py 2010-06-07 18:34:41.332625735 +0200 +++ m2crypto/M2Crypto/SSL/Connection.py 2010-06-07 18:36:40.181602072 +0200 @@ -41,6 +41,10 @@ if self._timeout is None: self._timeout = -1.0 + if self.ctx.post_connection_check is not None: + self.set_post_connection_check_callback \ + (self.ctx.post_connection_check) + def __del__(self): if getattr(self, 'sslbio', None): self.m2_bio_free(self.sslbio) --- m2crypto/M2Crypto/SSL/Context.py 2010-06-07 18:34:41.331600870 +0200 +++ m2crypto/M2Crypto/SSL/Context.py 2010-06-07 18:34:51.655852405 +0200 @@ -34,12 +34,14 @@ m2_ssl_ctx_free = m2.ssl_ctx_free - def __init__(self, protocol='sslv23', weak_crypto=None): + def __init__(self, protocol='sslv23', weak_crypto=None, + post_connection_check=None): proto = getattr(m2, protocol + '_method', None) if proto is None: raise ValueError, "no such protocol '%s'" % protocol self.ctx = m2.ssl_ctx_new(proto()) self.allow_unknown_ca = 0 + self.post_connection_check = post_connection_check map()[long(self.ctx)] = self m2.ssl_ctx_set_cache_size(self.ctx, 128L) if weak_crypto is None: