[issue43582] SSLContext.sni_callback docs inaccurately describe available handshake info

Christian Heimes report at bugs.python.org
Sun Mar 21 17:16:32 EDT 2021


Christian Heimes <lists at cheimes.de> added the comment:

The callback from context.alpn_callback would fire when OpenSSL handles the ALPN extension. Since the callback is triggered in the ClientHello phase of the handshake, you'll be able to replace the socket's context with another context.

The OpenSSL codes work a bit like this:

TLSEXT_INDEX = [
    ...,
    TLSEXT_IDX_server_name,
    ...,
    TLSEXT_IDX_application_layer_protocol_negotiation,
]

for extid in TLSEXT_INDEX:
    if client.has_extension(extid):
        ext = do_stuff(client, extid)
        ext.callback(client)

Any of the callbacks is able to replace the context.

The process for contributing to Python is explained in the devguide:
https://devguide.python.org/. Please start by signing a contributor agreement. Then you can file a PR on Github.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43582>
_______________________________________


More information about the Python-bugs-list mailing list