Fix out-of-bounds error when incorporating email from stdin
[mmh] / test / tests / mhlist / test-ext-params
1 #!/bin/sh
2 ######################################################
3 #
4 # Test mhlist with extended parameters (RFC 2231)
5 #
6 ######################################################
7
8 . "$MH_TEST_COMMON"
9
10 test_skip "not implemented yet"
11 exit
12
13 require_locale en_US.utf-8 en_US.utf8
14 LC_ALL=en_US.UTF-8
15 export LC_ALL
16
17
18 #
19 # Make some more complicated message parameters.
20 #
21
22 msgfile=`mhpath b`
23 cat > $msgfile <<EOF
24 To: recipient@example.com
25 From: sender@example.com
26 Subject: mhlist ext param test 2
27 MIME-Version: 1.0
28 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
29
30 ------- =_aaaaaaaaaa0
31 Content-Type: text/plain; charset=us-ascii;
32         name*=utf-8''This%20%C3%AFs%20the%20filename
33
34 This is a test
35
36 ------- =_aaaaaaaaaa0
37 Content-Type: image/jpeg; name*3=" will it be?.jpg";
38         longparam*5*=Sp%C4%B1n%CC%88al%20Tap!;
39         longparam*2=It; name*1=if;
40         longparam*3=" Might be our Long Lost Band";
41         longparam*0*=UTF-8'en'I%20Cannot%20Believe%20It;
42         name*0="This is an example of a very long filename. I wonder ";
43         longparam*4*=%20The%20%C3%96ne%20And%20Only%20;
44         name*2=" this filename might be too long.  It should not be.  But";
45         longparam*1=", it Looks Like "
46 Content-Transfer-Encoding: base64
47
48 /9g=
49
50 ------- =_aaaaaaaaaa0--
51 EOF
52
53 runandcheck 'mhlist l -verbose' <<!
54  msg part  type/subtype              size description                         
55   11       multipart/mixed            647
56                 boundary="----- =_aaaaaaaaaa0"
57      1     text/plain                  15
58                 charset="us-ascii"
59                 name="This ïs the filename"
60      2     image/jpeg                   2
61                 longparam="I Cannot Believe It, it Looks Like It Might be our Long Lost Band The Öne And Only Spın̈al Tap!"
62                 name="This is an example of a very long filename. I wonder if this filename might be too long.  It should not be.  But will it be?.jpg"
63 !
64
65
66
67
68 #
69 # Write a message with some extended parameters
70 #
71
72 msgfile=`mhpath b`
73 cat > $msgfile <<EOF
74 To: recipient@example.com
75 From: sender@example.com
76 Subject: mhlist ext param test 1
77 MIME-Version: 1.0
78 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
79
80 ------- =_aaaaaaaaaa0
81 Content-Type: text/plain; charset=us-ascii;
82         name*=utf-8''This%20%C3%AFs%20the%20filename
83
84 This is a test
85
86 ------- =_aaaaaaaaaa0
87 Content-Type: image/jpeg;
88         name*0="This is an example of a very long filename. I wonder ";
89         name*1=if;
90         name*2=" this filename might be too long.  It should not be.  But";
91         name*3=" will it be?.jpg"
92 Content-Disposition: attachment;
93         filename*0="This is an example of a very long filename. I wonder ";
94         filename*1=if;
95         filename*2=" this filename might be too long.  It should not be.  But";
96         filename*3=" will it be?.jpg"
97 Content-Transfer-Encoding: base64
98
99 /9g=
100
101 ------- =_aaaaaaaaaa0--
102 EOF
103
104 # check to see if we decode parameters correctly.
105
106 runandcheck 'mhlist l -verbose -disposition' <<!
107  msg part  type/subtype              size description                         
108   11       multipart/mixed            637
109              boundary="----- =_aaaaaaaaaa0"
110      1     text/plain                  15
111              charset="us-ascii"
112              name="This ïs the filename"
113      2     image/jpeg                   2
114              name="This is an example of a very long filename. I wonder if this filename might be too long.  It should not be.  But will it be?.jpg"
115              disposition "attachment"
116                filename="This is an example of a very long filename. I wonder if this filename might be too long.  It should not be.  But will it be?.jpg"
117 !
118
119 #
120 # Test out message/external-body types, and also make sure we will correctly
121 # decode a URL wrapped with RFC 2017 rules.
122 #
123
124 msgfile=`mhpath b`
125 cat > $msgfile <<EOF
126 To: recipient@example.com
127 From: sender@example.com
128 Subject: mhlist ext param test 3
129 MIME-Version: 1.0
130 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
131
132 ------- =_aaaaaaaaaa0
133 Content-Type: text/plain; charset=us-ascii;
134         name*=utf-8''This%20%C3%AFs%20the%20filename
135
136 This is a test
137
138 ------- =_aaaaaaaaaa0
139 Content-Type: message/external-body; access-type="url";
140         url*1="/that/should-be-wrapped/image.jpeg";
141         url*0="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url"
142
143 Content-Type: image/jpeg
144 Content-Description: Test of a long URL
145 Content-Disposition: attachment; filename=image.jpeg
146
147 ------- =_aaaaaaaaaa0
148 Content-Type: message/external-body; access-type="url";
149         url*0="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url
150                /that/should-be-wrapped/image.jpeg"
151
152 Content-Type: image/jpeg
153 Content-Description: Test of a long URL
154 Content-Disposition: attachment; filename=image.jpeg
155
156 ------- =_aaaaaaaaaa0--
157 EOF
158
159 runandcheck 'mhlist l -verbose -disposition' <<!
160  msg part  type/subtype              size description                         
161   13       multipart/mixed            775
162              boundary="----- =_aaaaaaaaaa0"
163      1     text/plain                  15
164              charset="us-ascii"
165              name="This ïs the filename"
166      2     message/external-body      118
167              access-type="url"
168              url="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url/that/should-be-wrapped/image.jpeg"
169              url="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url/that/should-be-wrapped/image.jpeg"
170              access-type="url"
171            image/jpeg                     Test of a long URL
172              disposition "attachment"
173                filename="image.jpeg"
174      3     message/external-body      118
175              access-type="url"
176              url="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url          /that/should-be-wrapped/image.jpeg"
177              url="http://www.kremvax.ru/this/is/an/example/of/a/very/long/url/that/should-be-wrapped/image.jpeg"
178              access-type="url"
179            image/jpeg                     Test of a long URL
180              disposition "attachment"
181                filename="image.jpeg"
182 !
183