diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 0e6abda..61d7294 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2219,6 +2219,13 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds) sizeof(SID_CTX)); #undef SID_CTX +#ifdef X509_V_FLAG_TRUSTED_FIRST + { + X509_STORE *store = SSL_CTX_get_cert_store(self->ctx); + X509_STORE_set_flags(store, X509_V_FLAG_TRUSTED_FIRST); + } +#endif + return (PyObject *)self; }