pyopenssl
pyopenssl copied to clipboard
allow for inspection of previously-set callbacks
APIs like set_info_callback don't have any way to retrieve the previously-set callback, so there's no way to non-destructively have two different libraries obtain information from the same context.
I'm having some issues with preserving compatibility guarantees within Twisted for folks who have set up their own Context objects.
Why on earth should two different libraries be trying to coordinate their info_callbacks on the same Context using pyOpenSSL as an intermediary?
In Twisted, the application hands us a Context object and that's basically the whole interface. Now we have features that Twisted wants to provide directly, but mangling the application-provided Context would break an application relying on that callback staying set.
The typical Python idiom for this sort of thing is for the set_..._callback function to return the previously-set callback for specifically this reason.
It's worth noting that OpenSSL recognizes the need for this as well, and does have SSL_CTX_get_info_callback and SSL_get_info_callback; they're just not exposed by pyOpenSSL.