Unquoted @ chars in received email headers are parsed properly in spite of RFC 822 (#1206)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1476 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck
2005-06-22 09:59:14 +00:00
parent 1d4d721782
commit 996fa1526d
5 changed files with 46 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
*SVN*
* Unquoted @ characters in headers are now accepted in spite of RFC 822 #1206
* Helper support (borrowed from ActionPack)
* Silently ignore Errno::EINVAL errors when converting text.

View File

@@ -25,8 +25,8 @@ module TMail
}
alnum = 'a-zA-Z0-9'
atomsyms = %q[ _#!$%&`'*+-{|}~^/=? ].strip
tokensyms = %q[ _#!$%&`'*+-{|}~^. ].strip
atomsyms = %q[ _#!$%&`'*+-{|}~^@/=? ].strip
tokensyms = %q[ _#!$%&`'*+-{|}~^@. ].strip
atomchars = alnum + Regexp.quote(atomsyms)
tokenchars = alnum + Regexp.quote(tokensyms)

View File

@@ -36,8 +36,8 @@ module TMail
module TextUtils
aspecial = '()<>[]:;.@\\,"'
tspecial = '()<>[];:@\\,"/?='
aspecial = '()<>[]:;.\\,"'
tspecial = '()<>[];:\\,"/?='
lwsp = " \t\r\n"
control = '\x00-\x1f\x7f-\xff'

34
actionmailer/test/fixtures/raw_email11 vendored Normal file
View File

@@ -0,0 +1,34 @@
From xxx@xxxx.com Wed Apr 27 14:15:31 2005
Mime-Version: 1.0 (Apple Message framework v619.2)
To: xxxxx@xxxxx <matmail>
Message-Id: <416eaebec6d333ec6939eaf8a7d80724@xxxxx>
Content-Type: multipart/alternative;
boundary=Apple-Mail-5-1037861608
From: xxxxx@xxxxx <xxxxx@xxxxx>
Subject: worse when you use them.
Date: Wed, 27 Apr 2005 14:15:31 -0700
--Apple-Mail-5-1037861608
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
XXXXX Xxxxx
--Apple-Mail-5-1037861608
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
charset=US-ASCII
<bold>XXXXX Xxxxx</bold>
--Apple-Mail-5-1037861608--

View File

@@ -521,5 +521,11 @@ EOF
mail = TMail::Mail.parse(fixture)
assert_nothing_raised { mail.body }
end
def test_decode_message_with_unquoted_atchar_in_header
fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email11")
mail = TMail::Mail.parse(fixture)
assert_not_nil mail.from
end
end