]> granicus.if.org Git - python/commitdiff
Define a "session_id_context" at context creation. This is recommended
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 13 Oct 2010 12:46:13 +0000 (12:46 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 13 Oct 2010 12:46:13 +0000 (12:46 +0000)
for the OpenSSL server-side session cache.

Modules/_ssl.c

index 4f7bb4d50dedb4c4131a0679779a4150e4ee0650..499ecba56d2d3b9c4d87403c9814201f4a220e5f 100644 (file)
@@ -1478,6 +1478,11 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
     SSL_CTX_set_verify(self->ctx, SSL_VERIFY_NONE, NULL);
     SSL_CTX_set_options(self->ctx, SSL_OP_ALL);
 
+#define SID_CTX "Python"
+    SSL_CTX_set_session_id_context(self->ctx, (const unsigned char *) SID_CTX,
+                                   sizeof(SID_CTX));
+#undef SID_CTX
+
     return (PyObject *)self;
 }