diff options
author | Jamis Buck <jamis@37signals.com> | 2005-06-22 09:59:14 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-06-22 09:59:14 +0000 |
commit | 996fa1526dd238a12e1f6173090d8bcbbfd567d2 (patch) | |
tree | cb2885d50afa3aa7a640dcb89e42d55457d349d1 | |
parent | 1d4d721782dd1d89435f79261b954eb0f163b312 (diff) | |
download | rails-996fa1526dd238a12e1f6173090d8bcbbfd567d2.tar.gz rails-996fa1526dd238a12e1f6173090d8bcbbfd567d2.tar.bz2 rails-996fa1526dd238a12e1f6173090d8bcbbfd567d2.zip |
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
-rw-r--r-- | actionmailer/CHANGELOG | 2 | ||||
-rwxr-xr-x | actionmailer/lib/action_mailer/vendor/tmail/scanner_r.rb | 4 | ||||
-rwxr-xr-x | actionmailer/lib/action_mailer/vendor/tmail/utils.rb | 4 | ||||
-rw-r--r-- | actionmailer/test/fixtures/raw_email11 | 34 | ||||
-rwxr-xr-x | actionmailer/test/mail_service_test.rb | 6 |
5 files changed, 46 insertions, 4 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index 7dd63af77d..2ac696fba7 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -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. diff --git a/actionmailer/lib/action_mailer/vendor/tmail/scanner_r.rb b/actionmailer/lib/action_mailer/vendor/tmail/scanner_r.rb index fb90f9b5e9..7722c75336 100755 --- a/actionmailer/lib/action_mailer/vendor/tmail/scanner_r.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail/scanner_r.rb @@ -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) diff --git a/actionmailer/lib/action_mailer/vendor/tmail/utils.rb b/actionmailer/lib/action_mailer/vendor/tmail/utils.rb index 57919473f1..5dc1f812e5 100755 --- a/actionmailer/lib/action_mailer/vendor/tmail/utils.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail/utils.rb @@ -36,8 +36,8 @@ module TMail module TextUtils - aspecial = '()<>[]:;.@\\,"' - tspecial = '()<>[];:@\\,"/?=' + aspecial = '()<>[]:;.\\,"' + tspecial = '()<>[];:\\,"/?=' lwsp = " \t\r\n" control = '\x00-\x1f\x7f-\xff' diff --git a/actionmailer/test/fixtures/raw_email11 b/actionmailer/test/fixtures/raw_email11 new file mode 100644 index 0000000000..8af74b87cf --- /dev/null +++ b/actionmailer/test/fixtures/raw_email11 @@ -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-- + diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index d9f6935674..b61565023c 100755 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -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 |