summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index bea144c..f3c3b20 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2202,6 +2202,11 @@ static int PySSL_set_context(PySSLSocket *self, PyObject *value,
Py_INCREF(value);
Py_SETREF(self->ctx, (PySSLContext *)value);
SSL_set_SSL_CTX(self->ssl, self->ctx->ctx);
+ /* Set SSL* internal msg_callback to state of new context's state */
+ SSL_set_msg_callback(
+ self->ssl,
+ self->ctx->msg_cb ? _PySSL_msg_callback : NULL
+ );
#endif
} else {
PyErr_SetString(PyExc_TypeError, "The value must be a SSLContext");