Skip to content

Commit 4b35e19

Browse files
committed
Define a "session_id_context" at context creation. This is recommended
for the OpenSSL server-side session cache.
1 parent 792ab51 commit 4b35e19

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: Modules/_ssl.c

+5
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,11 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
14781478
SSL_CTX_set_verify(self->ctx, SSL_VERIFY_NONE, NULL);
14791479
SSL_CTX_set_options(self->ctx, SSL_OP_ALL);
14801480

1481+
#define SID_CTX "Python"
1482+
SSL_CTX_set_session_id_context(self->ctx, (const unsigned char *) SID_CTX,
1483+
sizeof(SID_CTX));
1484+
#undef SID_CTX
1485+
14811486
return (PyObject *)self;
14821487
}
14831488

0 commit comments

Comments
 (0)