fix: compose user SSL_create_ctx_callback with internal MODE_AUTO_RETRY#21
Draft
Koan-Bot wants to merge 1 commit into
Draft
fix: compose user SSL_create_ctx_callback with internal MODE_AUTO_RETRY#21Koan-Bot wants to merge 1 commit into
Koan-Bot wants to merge 1 commit into
Conversation
…RY callback When a user provides SSL_create_ctx_callback in SSL_options, HTTP::Tiny was silently overwriting it with its own internal callback that sets Net::SSLeay::MODE_AUTO_RETRY. This prevented use cases such as restricting signature algorithms for dual-certificate servers. The fix captures the user-provided callback from the ssl_args hash (which already includes user SSL_options) and composes it with the internal callback: MODE_AUTO_RETRY is set first, then the user's callback is called. If no user callback is provided, behaviour is unchanged. Fixes Perl-Toolchain-Gang#19 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a user provides
SSL_create_ctx_callbackinSSL_options, HTTP::Tiny was silently overwriting it with its own internal callback that setsNet::SSLeay::MODE_AUTO_RETRY. This prevented advanced TLS use cases such as restricting signature algorithms to connect to dual-certificate servers (post-quantum + RSA).The fix captures the user-provided callback before calling
IO::Socket::SSL::start_SSLand composes it with the internal callback:MODE_AUTO_RETRYis always set first, then the user's callback is invoked. If no user callback is provided, behaviour is unchanged.Fixes #19
Changes
lib/HTTP/Tiny.pm: InHTTP::Tiny::Handle::start_ssl, extract any user-providedSSL_create_ctx_callbackfrom_ssl_argsand compose it with the internalMODE_AUTO_RETRYcallback instead of replacing it.t/185_ssl_ctx_callback.t: New test file verifying that_ssl_argspreserves the user callback, thatstart_sslcomposes both callbacks correctly, and that behaviour without a user callback is unchanged.Test plan
t/185_ssl_ctx_callback.t(7 assertions): mocksIO::Socket::SSL::start_SSLandNet::SSLeay::CTX_set_modeto verify both the internal MODE_AUTO_RETRY and the user callback are called from the composed callback.prove -Ilib t/*.t): all 32 test files pass, 465 assertions.Generated by Kōan /fix
Quality Report
Changes: 2 files changed, 113 insertions(+)
Code scan: clean
Tests: skipped
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline