提交 996fa152 编写于 作者: J Jamis Buck

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
上级 1d4d7217
*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.
......
......@@ -25,8 +25,8 @@ class Scanner_R
}
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)
......
......@@ -36,8 +36,8 @@ def TMail.random_tag
module TextUtils
aspecial = '()<>[]:;.@\\,"'
tspecial = '()<>[];:@\\,"/?='
aspecial = '()<>[]:;.\\,"'
tspecial = '()<>[];:\\,"/?='
lwsp = " \t\r\n"
control = '\x00-\x1f\x7f-\xff'
......
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--
......@@ -521,5 +521,11 @@ def test_decode_message_with_unknown_charset
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册