This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients alex, christian.heimes, docs@python, dstufft, janssen, njs, theandrew168
Date 2021-03-21.18:00:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616349639.55.0.17271253142.issue43582@roundup.psfhosted.org>
In-reply-to
Content
SSLContext.set_alpn_protocols() is a high level interface on top of SSL_CTX_set_alpn_select_cb(). Python doesn't directly expose the ALPN selector callback. The ssl module only provides a way to set a hard-coded callback that wraps SSL_select_next_proto().

https://github.com/python/cpython/blob/9a50ef43e42ee32450a81ce13ed5a0729d3b84e8/Modules/_ssl.c#L3487-L3535

https://github.com/python/cpython/blob/9a50ef43e42ee32450a81ce13ed5a0729d3b84e8/Modules/_ssl.c#L3393-L3415

To solve your problem Python would have to support something like:

def alpn_cb(sslsocket, client_alpn_protocols, negotiated):
    return negotiated

context.alpn_cb = alpn_cb
History
Date User Action Args
2021-03-21 18:00:39christian.heimessetrecipients: + christian.heimes, janssen, alex, njs, docs@python, dstufft, theandrew168
2021-03-21 18:00:39christian.heimessetmessageid: <1616349639.55.0.17271253142.issue43582@roundup.psfhosted.org>
2021-03-21 18:00:39christian.heimeslinkissue43582 messages
2021-03-21 18:00:39christian.heimescreate