Skip to content

Instantly share code, notes, and snippets.

@alex
Created March 1, 2015 20:16
Show Gist options
  • Save alex/1cff35a2e673c11567cd to your computer and use it in GitHub Desktop.
Save alex/1cff35a2e673c11567cd to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment