Skip to content

Preserve caller SSL context options when starting SMTP - #99

Open
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/options-smtp
Open

Preserve caller SSL context options when starting SMTP#99
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/options-smtp

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Copy ssl_context_params before adding the default verify_mode. Starting a session must not mutate a caller-owned option hash, and frozen hashes should remain usable. This preserves the existing verification defaults and explicit overrides.

Reproduction

require 'net/smtp'
smtp = Net::SMTP.new('example.invalid', starttls: false)
options = {}.freeze
smtp.ssl_context_params = options
def smtp.do_start(*) = nil  # keep this reproduction offline
def smtp.do_finish = nil
p smtp.start { :started }
# Before: FrozenError while inserting :verify_mode.
# After: :started; options remains empty and frozen.

Verification

  • 50 focused checks cover frozen/mutable input, existing verify_mode values, both tls_verify settings, option reference retention and a bounded localhost session with frozen empty options. Baseline: seven failed expectations; patched: zero.
  • Existing rake test: 95 tests, 170 assertions, zero failures/errors, on baseline and this isolated branch, Ruby 4.0.6 via rbenv. Existing local TLS cases are included.
  • Supplemental RuboCop Lint has the same six existing findings; Ruby syntax and git diff --check pass. No new/modified repository tests, dependencies or workflow settings.
  • Independent branch based on c2e9102e1f199a5a10e5261a776d752e64cc130f; runtime matches released 0.5.1. External focused checks were used under the consumer repository's no-new-tests policy.

Compatibility and limits

No signature, dependency, Ruby minimum or TLS policy change. The intentional behavior correction is that caller option hashes no longer acquire :verify_mode. This is a shallow copy; option values retain their existing treatment. Other Ruby/OS runtimes were not run locally. No production or external SMTP delivery was used. Maintainer CI status is separate from these local checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant