Skip to content

Normalize EHLO capability keywords without changing parameters - #104

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

Normalize EHLO capability keywords without changing parameters#104
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/capabilities-smtp

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Normalize EHLO extension keywords to uppercase while retaining parameter values. Lowercase/mixed-case replies currently leave capability lookups empty, including SMTPUTF8; RFC 5321 section 4.1.1.1 requires case-insensitive keyword handling.

Reproduction

require 'net/smtp'
response = Net::SMTP::Response.parse("250-fixture\r\n250-smtputf8\r\n250 size 12345\r\n")
p response.capabilities
# Before: {"smtputf8"=>[], "size"=>["12345"]}
# After:  {"SMTPUTF8"=>[], "SIZE"=>["12345"]}

Verification

  • 38 focused checks cover four keyword case variants, six extensions, parameter case preservation, frozen response input, existing single-line/empty-keyword behavior and a bounded localhost SMTPUTF8 sender command. Twenty-four failed expectations before; zero after. Existing Allow case-insensitive strings for SASL mechanism #64 normalizes requested authentication mechanism names; it does not handle EHLO response keywords. Standard: https://www.rfc-editor.org/rfc/rfc5321.html#section-4.1.1.1
  • 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 change. Capability hash keys are now canonical uppercase even when the server uses lowercase/mixed case. Code explicitly looking up a lowercase server spelling must use the canonical key. Parameters, including SASL mechanism names, are not case-folded. This is not a new malformed-response validation policy. 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