pyopenssl icon indicating copy to clipboard operation
pyopenssl copied to clipboard

allow for inspection of previously-set callbacks

Open glyph opened this issue 11 years ago • 3 comments

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.

glyph avatar Apr 05 '14 01:04 glyph

Why on earth should two different libraries be trying to coordinate their info_callbacks on the same Context using pyOpenSSL as an intermediary?

amluto avatar Apr 06 '14 00:04 amluto

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.

glyph avatar Apr 06 '14 05:04 glyph

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.

glyph avatar Apr 06 '14 05:04 glyph