cert_reqs=ssl.CERT_NONE) as s:
s.connect(self.server_addr)
self.assertEqual({}, s.getpeercert())
+ self.assertFalse(s.server_side)
# this should succeed because we specify the root cert
with test_wrap_socket(socket.socket(socket.AF_INET),
ca_certs=SIGNING_CA) as s:
s.connect(self.server_addr)
self.assertTrue(s.getpeercert())
+ self.assertFalse(s.server_side)
def test_connect_fail(self):
# This should fail because we have no verification certs. Connection
host = "127.0.0.1"
port = support.bind_port(server)
server = context.wrap_socket(server, server_side=True)
+ self.assertTrue(server.server_side)
evt = threading.Event()
remote = None
}
#ifndef OPENSSL_NO_COMP
+/* LCOV_EXCL_START */
static int COMP_get_type(const COMP_METHOD *meth)
{
return meth->type;
}
+/* LCOV_EXCL_END */
#endif
static pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx)
Py_RETURN_NONE;
}
#endif
-
- pysess = PyObject_New(PySSLSession, &PySSLSession_Type);
+ pysess = PyObject_GC_New(PySSLSession, &PySSLSession_Type);
if (pysess == NULL) {
SSL_SESSION_free(session);
return NULL;
pysess->ctx = self->ctx;
Py_INCREF(pysess->ctx);
pysess->session = session;
+ PyObject_GC_Track(pysess);
return (PyObject *)pysess;
}
static void
PySSLSession_dealloc(PySSLSession *self)
{
+ PyObject_GC_UnTrack(self);
Py_XDECREF(self->ctx);
if (self->session != NULL) {
SSL_SESSION_free(self->session);
}
- PyObject_Del(self);
+ PyObject_GC_Del(self);
}
static PyObject *
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
(traverseproc)PySSLSession_traverse, /*tp_traverse*/
(inquiry)PySSLSession_clear, /*tp_clear*/
}
#ifndef OPENSSL_NO_EGD
+/* LCOV_EXCL_START */
/*[clinic input]
_ssl.RAND_egd
path: object(converter="PyUnicode_FSConverter")
}
return PyLong_FromLong(bytes);
}
+/* LCOV_EXCL_STOP */
#endif /* OPENSSL_NO_EGD */