Repository navigation
Commit 77e8b6d
committed
ssl: keep original SSLContext alive after servername_cb
Keep the original SSLContext in a separate instance variable to prevent
it from being GC'ed while its underlying SSL_CTX is still in use.
When the SNI callback accepts the provided server name, it can replace
the SSL_CTX with SSL_set_SSL_CTX() and update SSLSocket#context.
However, although this is poorly documented, SSL_set_SSL_CTX() does not
appear to replace all uses of the original SSL_CTX with the new one. In
particular, session management still uses the original SSL_CTX and
therefore requires that the corresponding SSLContext object to remain
alive for the lifetime of SSLSocket.1 parent 9796ee8 commit 77e8b6d
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
1694 | 1695 | | |
1695 | 1696 | | |
1696 | 1697 | | |
| 1698 | + | |
1697 | 1699 | | |
1698 | 1700 | | |
1699 | 1701 | | |
| |||
3359 | 3361 | | |
3360 | 3362 | | |
3361 | 3363 | | |
| 3364 | + | |
3362 | 3365 | | |
3363 | 3366 | | |
3364 | 3367 | | |
| |||
0 commit comments