Permalink
Browse files

Add a test case for malformed email headers

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1391 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 481d579 commit 5c2e0fe6491761ba2c55b780663d7f9ec86a62cc @jamis jamis committed Jun 6, 2005
Showing with 33 additions and 0 deletions.
  1. +28 −0 actionmailer/test/fixtures/raw_email9
  2. +5 −0 actionmailer/test/mail_service_test.rb
@@ -0,0 +1,28 @@
+Received: from xxx.xxx.xxx ([xxx.xxx.xxx.xxx] verified)
+ by xxx.com (CommuniGate Pro SMTP 4.2.8)
+ with SMTP id 2532598 for xxx@xxx.com; Wed, 23 Feb 2005 17:51:49 -0500
+Received-SPF: softfail
+ receiver=xxx.com; client-ip=xxx.xxx.xxx.xxx; envelope-from=xxx@xxx.xxx
+quite Delivered-To: xxx@xxx.xxx
+Received: by xxx.xxx.xxx (Wostfix, from userid xxx)
+ id 0F87F333; Wed, 23 Feb 2005 16:16:17 -0600
+Date: Wed, 23 Feb 2005 18:20:17 -0400
+From: "xxx xxx" <xxx@xxx.xxx>
+Message-ID: <4D6AA7EB.6490534@xxx.xxx>
+To: xxx@xxx.com
+Subject: Stop adware/spyware once and for all.
+X-Scanned-By: MIMEDefang 2.11 (www dot roaringpenguin dot com slash mimedefang)
+
+You are infected with:
+Ad Ware and Spy Ware
+
+Get your free scan and removal download now,
+before it gets any worse.
+
+http://xxx.xxx.info?aid=3D13&?stat=3D4327kdzt
+
+
+
+
+no more? (you will still be infected)
+http://xxx.xxx.info/discon/?xxx@xxx.com
@@ -510,5 +510,10 @@ def test_decode_encoded_attachment_filename
attachment = mail.attachments.last
assert_equal "01QuienTeDijat.Pitbull.mp3", attachment.original_filename
end
+
+ def test_wrong_mail_header
+ fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email9")
+ assert_raise(TMail::SyntaxError) { TMail::Mail.parse(fixture) }
+ end
end

0 comments on commit 5c2e0fe

Please sign in to comment.