diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index cca06e6..d77f037 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -1104,7 +1104,7 @@ def capabilities h = {} @string.lines.drop(1).each do |line| k, *v = line[4..-1].split(' ') - h[k] = v + h[k&.upcase] = v end h end diff --git a/test/net/smtp/test_response.rb b/test/net/smtp/test_response.rb index 3cf909a..84da1c1 100644 --- a/test/net/smtp/test_response.rb +++ b/test/net/smtp/test_response.rb @@ -24,6 +24,15 @@ def test_capabilities_value assert_equal ['1234'], res.capabilities['SIZE'] end + def test_capabilities_normalize_keyword_case_only + res = Response.parse("250-fixture\n250-smtputf8\n250 size MiXeD\n") + assert_equal({ + "SMTPUTF8" => [], + "SIZE" => ["MiXeD"], + }, + res.capabilities) + end + def test_capabilities_multi res = Response.parse("250-ubuntu-desktop\n250-SIZE 1 2 3\n250 DSN\n") assert_equal %w{1 2 3}, res.capabilities['SIZE']