@@ -687,6 +687,22 @@ def test_splitting_multiple_long_lines(self):
687687688688\t Sat, 2 Feb 2002 17:00:06 -0800 (PST)""" )
689689
690+ def test_splitting_first_line_only_is_long (self ):
691+ eq = self .ndiffAssertEqual
692+ hstr = """\
693+ from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93] helo=cthulhu.gerg.ca)
694+ \t by kronos.mems-exchange.org with esmtp (Exim 4.05)
695+ \t id 17k4h5-00034i-00
696+ \t for [email protected] ; Wed, 28 Aug 2002 11:25:20 -0400"""697+ h = Header (hstr , maxlinelen = 78 , header_name = 'Received' ,
698+ continuation_ws = '\t ' )
699+ eq (h .encode (), """\
700+ from modemcable093.139-201-24.que.mc.videotron.ca ([24.201.139.93]
701+ \t helo=cthulhu.gerg.ca)
702+ \t by kronos.mems-exchange.org with esmtp (Exim 4.05)
703+ \t id 17k4h5-00034i-00
704+ \t for [email protected] ; Wed, 28 Aug 2002 11:25:20 -0400""")
705+
690706
691707
692708# Test mangling of "From " lines in the body of a message
@@ -1011,7 +1027,7 @@ def test_bogus_boundary(self):
10111027 data = fp .read ()
10121028 finally :
10131029 fp .close ()
1014- p = Parser ()
1030+ p = Parser (strict = 1 )
10151031 # Note, under a future non-strict parsing mode, this would parse the
10161032 # message into the intended message tree.
10171033 self .assertRaises (Errors .BoundaryError , p .parsestr , data )
@@ -1045,6 +1061,23 @@ def test_invalid_content_type(self):
10451061 g .flatten (msg )
10461062 neq (s .getvalue (), 'Content-Type: foo\n \n ' )
10471063
1064+ def test_no_start_boundary (self ):
1065+ eq = self .ndiffAssertEqual
1066+ msg = self ._msgobj ('msg_31.txt' )
1067+ eq (msg .get_payload (), """\
1068+ --BOUNDARY
1069+ Content-Type: text/plain
1070+
1071+ message 1
1072+
1073+ --BOUNDARY
1074+ Content-Type: text/plain
1075+
1076+ message 2
1077+
1078+ --BOUNDARY--
1079+ """ )
1080+
10481081
10491082
10501083# Test RFC 2047 header encoding and decoding
@@ -1428,6 +1461,10 @@ def test_multipart_no_parts(self):
14281461 msg , text = self ._msgobj ('msg_24.txt' )
14291462 self ._idempotent (msg , text )
14301463
1464+ def test_no_start_boundary (self ):
1465+ msg , text = self ._msgobj ('msg_31.txt' )
1466+ self ._idempotent (msg , text )
1467+
14311468 def test_content_type (self ):
14321469 eq = self .assertEquals
14331470 unless = self .failUnless
0 commit comments