gurgitate-mail 1.10.1 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,7 +33,7 @@ module Gurgitate
33
33
  # some more (printable, but can include whitespaces)
34
34
  # crap.
35
35
  if(header[0] =~ /^[\x21-\x39\x3b-\x7e]+:/) then
36
- (name,contents)=header[0].split(/:\s+/,2)
36
+ (name,contents)=header[0].split(/:\s*/,2)
37
37
  if(name =~ /:$/ and contents == nil) then
38
38
  # It looks like someone is using Becky!
39
39
  name=header[0].gsub(/:$/,"")
@@ -302,6 +302,54 @@ EOF
302
302
  assert_equal("IAP password",h["Subject"][0].contents)
303
303
  end
304
304
 
305
+ def test_yet_another_crashy_set_of_headers
306
+ h = nil
307
+ assert_nothing_raised do
308
+ h = Gurgitate::Headers.new(<<'EOF')
309
+ Return-Path: <chailatte@detroit.blackbox.com>
310
+ X-Original-To: ML01547@gmo.jp
311
+ Delivered-To: ML01547@gmo.jp
312
+ Received: from localhost (localhost [127.0.0.1])
313
+ by mx.gmo.jp (Postfix) with ESMTP id 0469888958;
314
+ Tue, 27 May 2008 13:11:15 +0900 (JST)
315
+ X-Quarantine-ID: <T9cVuddV5I5W>
316
+ X-Virus-Scanned: amavisd-new at gmo.jp
317
+ X-Amavis-Alert: BAD HEADER, Non-encoded 8-bit data (char 82 hex): Subject:
318
+ \202\307\202\247\202\274\201I\201I\n
319
+ X-Spam-Flag: YES
320
+ X-Spam-Score: 15.944
321
+ X-Spam-Level: ***************
322
+ X-Spam-Status: Yes, score=15.944 tagged_above=2 required=6.31
323
+ tests=[ALL_TRUSTED=-1.44, NO_REAL_NAME=0.55, SUBJ_ILLEGAL_CHARS=3.36,
324
+ UPPERCASE_50_75=0.591, URIBL_AB_SURBL=3.306, URIBL_JP_SURBL=3.36,
325
+ URIBL_OB_SURBL=2.617, URIBL_SC_SURBL=3.6]
326
+ Received: from mx.gmo.jp ([127.0.0.1])
327
+ by localhost (corpmx02.gmo.jp [127.0.0.1]) (amavisd-new, port 10024)
328
+ with ESMTP id T9cVuddV5I5W; Tue, 27 May 2008 13:11:06 +0900 (JST)
329
+ Received: from pc-28-60-241-201.cm.vtr.net (pc-28-60-241-201.cm.vtr.net [201.241.60.28])
330
+ by mx.gmo.jp (Postfix) with SMTP id BB6C98883A
331
+ for <admin@zero-isp.net>; Tue, 27 May 2008 13:11:03 +0900 (JST)
332
+ From:<chailatte@detroit.blackbox.com>
333
+ To: admin@zero-isp.net
334
+ Subject: ***SPAM*** =?iso-8859-1?Q?=82=C7=82=A7=82=BC=81I=81I?=
335
+ Date: Tue, 27 May 2008 13:11:03 +0900
336
+ X-Info:admin@zero-isp.net
337
+ MIME-Version: 1.0
338
+ X-Antivirus: avast! (VPS 080527-0, 27/05/2008), Outbound message
339
+ X-Antivirus-Status: Clean
340
+ Message-Id: <20080527041104.BB6C98883A@mx.gmo.jp>
341
+ EOF
342
+ end
343
+
344
+ assert_equal("chailatte@detroit.blackbox.com", h.from)
345
+ assert_nothing_raised do
346
+ h["From"][0]
347
+ end
348
+
349
+ assert_equal("<chailatte@detroit.blackbox.com>", h["From"][0].contents)
350
+ end
351
+
352
+
305
353
  def test_fromheader_no_hostname # illegal from header?
306
354
  m=<<'EOF'
307
355
  From HEYITBLEWUP Sat Mar 27 16:02:12 PST 2004
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gurgitate-mail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: 1.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Brown