tmail 1.2.1 → 1.2.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.
- data/CHANGES +50 -5
- data/MANIFEST +188 -0
- data/NOTES +1 -1
- data/README +10 -4
- data/Rakefile +1 -10
- data/lib/tmail.rb +1 -0
- data/lib/tmail/Makefile +0 -1
- data/lib/tmail/address.rb +190 -17
- data/lib/tmail/attachments.rb +1 -1
- data/lib/tmail/base64.rb +4 -10
- data/lib/tmail/compat.rb +8 -6
- data/lib/tmail/config.rb +2 -6
- data/lib/tmail/core_extensions.rb +14 -18
- data/lib/tmail/encode.rb +47 -12
- data/lib/tmail/header.rb +7 -10
- data/lib/tmail/index.rb +2 -1
- data/lib/tmail/interface.rb +14 -12
- data/lib/tmail/loader.rb +2 -0
- data/lib/tmail/mail.rb +83 -24
- data/lib/tmail/mailbox.rb +70 -10
- data/lib/tmail/main.rb +2 -0
- data/lib/tmail/mbox.rb +2 -0
- data/lib/tmail/net.rb +16 -15
- data/lib/tmail/obsolete.rb +7 -12
- data/lib/tmail/parser.rb +1 -0
- data/lib/tmail/require_arch.rb +2 -0
- data/lib/tmail/scanner.rb +2 -1
- data/lib/tmail/scanner_r.rb +11 -10
- data/lib/tmail/utils.rb +83 -26
- data/lib/tmail/version.rb +3 -2
- data/log/BugTrackingLog.txt +1208 -0
- data/log/{ChangeLog.txt → Changelog-0.txt} +36 -0
- data/log/Changelog.txt +534 -0
- data/log/Testlog.txt +114 -0
- data/log/Todo.txt +0 -2
- data/meta/VERSION +1 -0
- data/meta/project.yaml +8 -5
- data/meta/unixname +1 -0
- data/setup.rb +1481 -0
- data/site/contributing/index.html +183 -0
- data/site/css/clean.css +27 -0
- data/site/css/layout.css +31 -0
- data/site/css/style.css +60 -0
- data/site/download/index.html +61 -0
- data/site/img/envelope.jpg +0 -0
- data/site/img/mailman.gif +0 -0
- data/site/img/stamp-sm.jpg +0 -0
- data/site/img/stamp.jpg +0 -0
- data/site/img/stampborder.jpg +0 -0
- data/site/img/tfire.jpg +0 -0
- data/site/img/tmail.png +0 -0
- data/site/index.html +270 -0
- data/site/js/jquery.js +31 -0
- data/site/log/Changelog.xsl +33 -0
- data/site/log/changelog.xml +1677 -0
- data/site/outdated/BUGS +3 -0
- data/site/outdated/DEPENDS +1 -0
- data/site/outdated/Incompatibilities +89 -0
- data/site/outdated/Incompatibilities.ja +102 -0
- data/site/outdated/NEWS +9 -0
- data/site/outdated/README.ja +73 -0
- data/site/outdated/doc.ja/address.html +275 -0
- data/site/outdated/doc.ja/basics.html +405 -0
- data/site/outdated/doc.ja/config.html +49 -0
- data/site/outdated/doc.ja/details.html +146 -0
- data/site/outdated/doc.ja/index.html +39 -0
- data/site/outdated/doc.ja/mail.html +793 -0
- data/site/outdated/doc.ja/mailbox.html +265 -0
- data/site/outdated/doc.ja/port.html +95 -0
- data/site/outdated/doc.ja/tmail.html +58 -0
- data/site/outdated/doc.ja/usage.html +202 -0
- data/site/outdated/rdd/address.rrd.m +229 -0
- data/site/outdated/rdd/basics.rd.m +275 -0
- data/site/outdated/rdd/config.rrd.m +26 -0
- data/site/outdated/rdd/details.rd.m +117 -0
- data/site/outdated/rdd/index.rhtml.m +54 -0
- data/site/outdated/rdd/mail.rrd.m +701 -0
- data/site/outdated/rdd/mailbox.rrd.m +228 -0
- data/site/outdated/rdd/port.rrd.m +69 -0
- data/site/outdated/rdd/tmail.rrd.m +33 -0
- data/site/outdated/rdd/usage.rd.m +247 -0
- data/site/quickstart/index.html +69 -0
- data/site/quickstart/quickstart.html +52 -0
- data/site/quickstart/usage.html +193 -0
- data/site/reference/address.html +247 -0
- data/site/reference/config.html +30 -0
- data/site/reference/index.html +101 -0
- data/site/reference/mail.html +726 -0
- data/site/reference/mailbox.html +245 -0
- data/site/reference/port.html +75 -0
- data/site/reference/tmail.html +35 -0
- data/test/fixtures/mailbox +405 -4
- data/test/fixtures/raw_email_multiple_from +30 -0
- data/test/kcode.rb +2 -2
- data/test/temp_test_one.rb +46 -0
- data/test/test_address.rb +77 -38
- data/test/test_encode.rb +0 -2
- data/test/test_header.rb +47 -24
- data/test/test_mail.rb +52 -9
- data/test/test_mbox.rb +28 -0
- data/test/test_port.rb +33 -27
- data/test/test_quote.rb +35 -8
- data/work/script/make +26 -0
- data/work/script/rdoc +39 -0
- data/{script → work/script}/setup +0 -0
- data/work/script/test +30 -0
- metadata +249 -184
- data/log/History.txt +0 -40
- data/meta/config.yaml +0 -8
- data/meta/icli.yaml +0 -16
- data/meta/tmail.roll +0 -3
- data/script/changelog +0 -19
- data/script/clobber/distclean +0 -8
- data/script/clobber/package +0 -10
- data/script/compile +0 -32
- data/script/pack/gem +0 -93
- data/script/pack/tgz +0 -41
- data/script/pack/zip +0 -41
- data/script/prepare +0 -15
- data/script/publish +0 -51
- data/script/rdoc +0 -42
- data/script/release +0 -10
- data/script/stamp +0 -33
- data/script/stats +0 -138
- data/script/tag +0 -25
- data/script/test +0 -36
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Delivered-To: tim@powerupdev.com
|
|
2
|
+
Return-Path: <www-data@mangaverde.net>
|
|
3
|
+
To: tim@powerupdev.com concierge@powerupdev.com
|
|
4
|
+
From: tim@powerupdev.com concierge@powerupdev.com
|
|
5
|
+
Subject: /home/svn/public/minebox revision 214
|
|
6
|
+
Reply-to: tim@powerupdev.com concierge@powerupdev.com
|
|
7
|
+
Message-Id: <20071022234523.5BD8E86D2@mangaverde.net>
|
|
8
|
+
Date: Mon, 22 Oct 2007 23:45:23 +0000 (UTC)
|
|
9
|
+
|
|
10
|
+
<p><b>recordkick</b> 2007-10-22 23:45:23 +0000 (Mon, 22 Oct 2007)</p><p>test
|
|
11
|
+
subversion<br>
|
|
12
|
+
</p><hr noshade><pre><font color=\"gray\">Modified:
|
|
13
|
+
trunk/README
|
|
14
|
+
===================================================================
|
|
15
|
+
--- trunk/README\t2007-10-22
|
|
16
|
+
23:41:34 UTC (rev 213)
|
|
17
|
+
+++ trunk/README\t2007-10-22 23:45:23 UTC (rev 214)
|
|
18
|
+
@@ -1,5 +1,5 @@
|
|
19
|
+
== Welcome
|
|
20
|
+
to Rails
|
|
21
|
+
-Test
|
|
22
|
+
+Tedst
|
|
23
|
+
Rails is a web-application and persistence framework that includes everything
|
|
24
|
+
needed
|
|
25
|
+
to create database-backed web-applications according to the
|
|
26
|
+
Model-View-Control pattern of separation. This pattern
|
|
27
|
+
splits the view (also
|
|
28
|
+
|
|
29
|
+
</font>
|
|
30
|
+
</pre>
|
data/test/kcode.rb
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
|
2
|
+
require 'test_helper'
|
|
3
|
+
require 'tmail'
|
|
4
|
+
require 'kcode'
|
|
5
|
+
require 'time'
|
|
6
|
+
|
|
7
|
+
class TestMail < Test::Unit::TestCase
|
|
8
|
+
include TMail::TextUtils
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@mail = TMail::Mail.new
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def lf( str )
|
|
15
|
+
str.gsub(/\n|\r\n|\r/) { "\n" }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def crlf( str )
|
|
19
|
+
str.gsub(/\n|\r\n|\r/) { "\r\n" }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_MIME
|
|
23
|
+
# FIXME: test more.
|
|
24
|
+
|
|
25
|
+
kcode('EUC') {
|
|
26
|
+
mail = TMail::Mail.parse('From: hoge@example.jp (=?iso-2022-jp?B?GyRCJUYlOSVIGyhC?=)')
|
|
27
|
+
assert_not_nil mail['From']
|
|
28
|
+
|
|
29
|
+
expected = "\245\306\245\271\245\310"
|
|
30
|
+
if expected.respond_to? :force_encoding
|
|
31
|
+
expected.force_encoding(mail['From'].comments.first.encoding)
|
|
32
|
+
end
|
|
33
|
+
assert_equal [expected], mail['From'].comments
|
|
34
|
+
|
|
35
|
+
expected = "From: hoge@example.jp (\245\306\245\271\245\310)\n\n"
|
|
36
|
+
expected.force_encoding 'EUC-JP' if expected.respond_to? :force_encoding
|
|
37
|
+
assert_equal expected, mail.to_s
|
|
38
|
+
assert_equal expected, mail.decoded
|
|
39
|
+
|
|
40
|
+
expected = "From: hoge@example.jp (=?iso-2022-jp?B?GyRCJUYlOSVIGyhC?=)\r\n\r\n"
|
|
41
|
+
expected.force_encoding 'EUC-JP' if expected.respond_to? :force_encoding
|
|
42
|
+
assert_equal expected, mail.encoded
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
data/test/test_address.rb
CHANGED
|
@@ -175,7 +175,7 @@ class TestAddress < Test::Unit::TestCase
|
|
|
175
175
|
# "\e$BF|K\\8l\e(B"
|
|
176
176
|
# GyRCRnxLXDhsGyhC
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
TMail.KCODE = 'NONE'
|
|
179
179
|
validate_case__address\
|
|
180
180
|
'=?iso-2022-jp?B?GyRCRnxLXDhsGyhC?= <aamine@loveruby.net>',
|
|
181
181
|
:display_name => "\e$BF|K\\8l\e(B",
|
|
@@ -192,10 +192,12 @@ class TestAddress < Test::Unit::TestCase
|
|
|
192
192
|
:domain => 'loveruby.net',
|
|
193
193
|
:format => '=?iso-2022-jp?B?GyRCRnxLXDhsGyhC?= <aamine@loveruby.net>'
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
TMail.KCODE = 'EUC'
|
|
196
|
+
expected = "\306\374\313\334\270\354"
|
|
197
|
+
expected.force_encoding('EUC-JP') if expected.respond_to? :force_encoding
|
|
196
198
|
validate_case__address\
|
|
197
199
|
'=?iso-2022-jp?B?GyRCRnxLXDhsGyhC?= <aamine@loveruby.net>',
|
|
198
|
-
:display_name =>
|
|
200
|
+
:display_name => expected,
|
|
199
201
|
:address => 'aamine@loveruby.net',
|
|
200
202
|
:local => 'aamine',
|
|
201
203
|
:domain => 'loveruby.net',
|
|
@@ -203,16 +205,18 @@ class TestAddress < Test::Unit::TestCase
|
|
|
203
205
|
|
|
204
206
|
validate_case__address\
|
|
205
207
|
'=?iso-2022-jp?Q?=1b=24=42=46=7c=4b=5c=38=6c=1b=28=42?= <aamine@loveruby.net>',
|
|
206
|
-
:display_name =>
|
|
208
|
+
:display_name => expected,
|
|
207
209
|
:address => 'aamine@loveruby.net',
|
|
208
210
|
:local => 'aamine',
|
|
209
211
|
:domain => 'loveruby.net',
|
|
210
212
|
:format => '=?iso-2022-jp?B?GyRCRnxLXDhsGyhC?= <aamine@loveruby.net>'
|
|
211
213
|
|
|
212
|
-
|
|
214
|
+
TMail.KCODE = 'SJIS'
|
|
215
|
+
expected = "\223\372\226{\214\352"
|
|
216
|
+
expected.force_encoding('SJIS') if expected.respond_to? :force_encoding
|
|
213
217
|
validate_case__address\
|
|
214
218
|
'=?iso-2022-jp?B?GyRCRnxLXDhsGyhC?= <aamine@loveruby.net>',
|
|
215
|
-
:display_name =>
|
|
219
|
+
:display_name => expected,
|
|
216
220
|
:address => 'aamine@loveruby.net',
|
|
217
221
|
:local => 'aamine',
|
|
218
222
|
:domain => 'loveruby.net',
|
|
@@ -220,7 +224,7 @@ class TestAddress < Test::Unit::TestCase
|
|
|
220
224
|
|
|
221
225
|
validate_case__address\
|
|
222
226
|
'=?iso-2022-jp?Q?=1b=24=42=46=7c=4b=5c=38=6c=1b=28=42?= <aamine@loveruby.net>',
|
|
223
|
-
:display_name =>
|
|
227
|
+
:display_name => expected,
|
|
224
228
|
:address => 'aamine@loveruby.net',
|
|
225
229
|
:local => 'aamine',
|
|
226
230
|
:domain => 'loveruby.net',
|
|
@@ -229,11 +233,11 @@ class TestAddress < Test::Unit::TestCase
|
|
|
229
233
|
|
|
230
234
|
def test_parse__rawjp
|
|
231
235
|
begin
|
|
232
|
-
|
|
236
|
+
TMail.KCODE = 'EUC'
|
|
233
237
|
_test_parse__euc
|
|
234
238
|
_test_parse__jis
|
|
235
239
|
ensure
|
|
236
|
-
|
|
240
|
+
TMail.KCODE = 'NONE'
|
|
237
241
|
end
|
|
238
242
|
end
|
|
239
243
|
|
|
@@ -253,7 +257,7 @@ class TestAddress < Test::Unit::TestCase
|
|
|
253
257
|
# raw iso-2022-jp string in comment
|
|
254
258
|
validate_case__address\
|
|
255
259
|
"Minero Aoki (\e$B@DLZJvO:\e(B) <aamine@loveruby.net>",
|
|
256
|
-
:display_name =>
|
|
260
|
+
:display_name => "Minero Aoki (\e$B@DLZJvO:\e(B)",
|
|
257
261
|
:address => 'aamine@loveruby.net',
|
|
258
262
|
:local => 'aamine',
|
|
259
263
|
:domain => 'loveruby.net',
|
|
@@ -691,7 +695,7 @@ class TestAddress < Test::Unit::TestCase
|
|
|
691
695
|
validate_case__address\
|
|
692
696
|
'(foo@bar.com (foobar), ned@foo.com (nedfoo) ) <kevin@goess.org>',
|
|
693
697
|
:name => 'foo@bar.com (foobar), ned@foo.com (nedfoo) ',
|
|
694
|
-
:display_name =>
|
|
698
|
+
:display_name => "(foo@bar.com (foobar), ned@foo.com (nedfoo) )",
|
|
695
699
|
:address => 'kevin@goess.org',
|
|
696
700
|
:comments => ['foo@bar.com (foobar), ned@foo.com (nedfoo) '],
|
|
697
701
|
:domain => 'goess.org',
|
|
@@ -886,32 +890,6 @@ class TestAddress < Test::Unit::TestCase
|
|
|
886
890
|
:local => 'bob',
|
|
887
891
|
:format => 'bob'
|
|
888
892
|
|
|
889
|
-
=begin
|
|
890
|
-
validate_case__address\
|
|
891
|
-
['bob,sally, sam',
|
|
892
|
-
[ { :name => nil,
|
|
893
|
-
:display_name => nil,
|
|
894
|
-
:address => 'bob',
|
|
895
|
-
:comments => nil,
|
|
896
|
-
:domain => nil,
|
|
897
|
-
:local => 'bob',
|
|
898
|
-
:format => 'bob' },
|
|
899
|
-
{ :name => nil,
|
|
900
|
-
:display_name => nil,
|
|
901
|
-
:address => 'sally',
|
|
902
|
-
:comments => nil,
|
|
903
|
-
:domain => nil,
|
|
904
|
-
:local => 'sally',
|
|
905
|
-
:format => 'sally' },
|
|
906
|
-
{ :name => nil,
|
|
907
|
-
:display_name => nil,
|
|
908
|
-
:address => 'sam',
|
|
909
|
-
:comments => nil,
|
|
910
|
-
:domain => nil,
|
|
911
|
-
:local => 'sam',
|
|
912
|
-
:format => 'sam' }] ]
|
|
913
|
-
=end
|
|
914
|
-
|
|
915
893
|
assert_raises(TMail::SyntaxError) {
|
|
916
894
|
TMail::Address.parse 'Undisclosed <>'
|
|
917
895
|
}
|
|
@@ -1138,7 +1116,7 @@ class TestAddress < Test::Unit::TestCase
|
|
|
1138
1116
|
|
|
1139
1117
|
end
|
|
1140
1118
|
|
|
1141
|
-
def
|
|
1119
|
+
def test_full_stop_as_last_char_in_display_name()
|
|
1142
1120
|
|
|
1143
1121
|
validate_case__address\
|
|
1144
1122
|
%Q(Minero A. <aamine@loveruby.net>),
|
|
@@ -1152,5 +1130,66 @@ class TestAddress < Test::Unit::TestCase
|
|
|
1152
1130
|
|
|
1153
1131
|
end
|
|
1154
1132
|
|
|
1133
|
+
def test_unquoted_at_char_in_name()
|
|
1134
|
+
|
|
1135
|
+
validate_case__address\
|
|
1136
|
+
%Q(mikel@me.com <lindsaar@you.net>),
|
|
1137
|
+
:name => "mikel@me.com",
|
|
1138
|
+
:display_name => "mikel@me.com",
|
|
1139
|
+
:address => %Q(lindsaar@you.net),
|
|
1140
|
+
:comments => nil,
|
|
1141
|
+
:domain => 'you.net',
|
|
1142
|
+
:local => %Q(lindsaar),
|
|
1143
|
+
:format => %Q("mikel@me.com" <lindsaar@you.net>)
|
|
1155
1144
|
|
|
1145
|
+
end
|
|
1146
|
+
|
|
1147
|
+
def test_special_quote_quoting_at_char_in_string
|
|
1148
|
+
string = 'mikel@me.com <mikel@me.com>'
|
|
1149
|
+
result = '"mikel@me.com" <mikel@me.com>'
|
|
1150
|
+
assert_equal(result, TMail::Address.special_quote_address(string))
|
|
1151
|
+
end
|
|
1152
|
+
|
|
1153
|
+
def test_special_quote_not_quoting_already_quoted_at_char_in_string
|
|
1154
|
+
string = '"mikel@me.com" <mikel@me.com>'
|
|
1155
|
+
result = '"mikel@me.com" <mikel@me.com>'
|
|
1156
|
+
assert_equal(result, TMail::Address.special_quote_address(string))
|
|
1157
|
+
end
|
|
1158
|
+
|
|
1159
|
+
def test_special_quote_not_quoting_something_without_an_at_char_and_quoted
|
|
1160
|
+
string = '"mikel" <mikel@me.com>'
|
|
1161
|
+
result = '"mikel" <mikel@me.com>'
|
|
1162
|
+
assert_equal(result, TMail::Address.special_quote_address(string))
|
|
1163
|
+
end
|
|
1164
|
+
|
|
1165
|
+
def test_special_quote_not_quoting_something_without_an_at_char_in_header
|
|
1166
|
+
string = 'mikel <mikel@me.com>'
|
|
1167
|
+
result = 'mikel <mikel@me.com>'
|
|
1168
|
+
assert_equal(result, TMail::Address.special_quote_address(string))
|
|
1169
|
+
end
|
|
1170
|
+
|
|
1171
|
+
def test_special_quoting_a_trailing_dot
|
|
1172
|
+
string = 'mikel. <mikel@me.com>'
|
|
1173
|
+
result = '"mikel." <mikel@me.com>'
|
|
1174
|
+
assert_equal(result, TMail::Address.special_quote_address(string))
|
|
1175
|
+
end
|
|
1176
|
+
|
|
1177
|
+
def test_special_quoting_a_trailing_dot_by_itself
|
|
1178
|
+
string = 'mikel . <mikel@me.com>'
|
|
1179
|
+
result = '"mikel ." <mikel@me.com>'
|
|
1180
|
+
assert_equal(result, TMail::Address.special_quote_address(string))
|
|
1181
|
+
end
|
|
1182
|
+
|
|
1183
|
+
def test_special_quoting_a_trailing_dot_by_itself_already_quoted
|
|
1184
|
+
string = '"mikel ." <mikel@me.com>'
|
|
1185
|
+
result = '"mikel ." <mikel@me.com>'
|
|
1186
|
+
assert_equal(result, TMail::Address.special_quote_address(string))
|
|
1187
|
+
end
|
|
1188
|
+
|
|
1189
|
+
def test_special_quoting_a_trailing_dot_by_itself_quoted
|
|
1190
|
+
string = 'mikel "." <mikel@me.com>'
|
|
1191
|
+
result = 'mikel "." <mikel@me.com>'
|
|
1192
|
+
assert_equal(result, TMail::Address.special_quote_address(string))
|
|
1193
|
+
end
|
|
1194
|
+
|
|
1156
1195
|
end
|
data/test/test_encode.rb
CHANGED
data/test/test_header.rb
CHANGED
|
@@ -95,7 +95,12 @@ class AddressHeaderTester < Test::Unit::TestCase
|
|
|
95
95
|
assert_equal ok[:routes], a.routes, str.inspect + " (routes)\n"
|
|
96
96
|
assert_equal ok[:spec], a.spec, str.inspect + " (spec)\n"
|
|
97
97
|
end
|
|
98
|
+
if comments.first.respond_to? :force_encoding
|
|
99
|
+
encoding = h.comments.first.encoding
|
|
100
|
+
comments.each { |c| c.force_encoding encoding }
|
|
101
|
+
end
|
|
98
102
|
assert_equal comments, h.comments, str.inspect + " (comments)\n"
|
|
103
|
+
to_s.force_encoding(h.to_s.encoding) if to_s.respond_to? :force_encoding
|
|
99
104
|
assert_equal to_s, h.to_s, str.inspect + " (to_s)\n" if to_s
|
|
100
105
|
assert_equal to_s, h.decoded, str.inspect + " (decoded)\n" if to_s
|
|
101
106
|
end
|
|
@@ -753,12 +758,12 @@ class ContentDispositionHeaderTester < Test::Unit::TestCase
|
|
|
753
758
|
_test_raw_sjis
|
|
754
759
|
_test_code_conversion
|
|
755
760
|
ensure
|
|
756
|
-
|
|
761
|
+
TMail.KCODE = 'NONE'
|
|
757
762
|
end
|
|
758
763
|
end
|
|
759
764
|
|
|
760
765
|
def _test_ATTRS
|
|
761
|
-
|
|
766
|
+
TMail.KCODE = 'NONE'
|
|
762
767
|
|
|
763
768
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
764
769
|
'attachment; filename="README.txt.pif"')
|
|
@@ -787,17 +792,19 @@ class ContentDispositionHeaderTester < Test::Unit::TestCase
|
|
|
787
792
|
end
|
|
788
793
|
|
|
789
794
|
def _test_rfc2231_decode
|
|
790
|
-
|
|
795
|
+
TMail.KCODE = 'EUC'
|
|
791
796
|
|
|
792
797
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
793
798
|
"attachment; filename*=iso-2022-jp'ja'%1b$B$Q$i$`%1b%28B")
|
|
794
799
|
assert_equal 'attachment', h.disposition
|
|
795
800
|
assert_equal 1, h.params.size
|
|
796
|
-
|
|
801
|
+
expected = "\244\321\244\351\244\340"
|
|
802
|
+
expected.force_encoding 'EUC-JP' if expected.respond_to? :force_encoding
|
|
803
|
+
assert_equal expected, h.params['filename']
|
|
797
804
|
end
|
|
798
805
|
|
|
799
806
|
def _test_rfc2231_encode
|
|
800
|
-
|
|
807
|
+
TMail.KCODE = 'EUC'
|
|
801
808
|
|
|
802
809
|
h = TMail::HeaderField.new('Content-Disposition', 'a; n=a')
|
|
803
810
|
h['n'] = "\245\265\245\363\245\327\245\353.txt"
|
|
@@ -811,73 +818,85 @@ class ContentDispositionHeaderTester < Test::Unit::TestCase
|
|
|
811
818
|
end
|
|
812
819
|
|
|
813
820
|
def _test_raw_iso2022jp
|
|
814
|
-
|
|
821
|
+
TMail.KCODE = 'EUC'
|
|
815
822
|
# raw iso2022jp string in value (token)
|
|
816
823
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
817
824
|
%Q<attachment; filename=\e$BF|K\\8l\e(B.doc>)
|
|
818
825
|
assert_equal 'attachment', h.disposition
|
|
819
826
|
assert_equal 1, h.params.size
|
|
820
827
|
# assert_equal "\e$BF|K\\8l\e(B.doc", h.params['filename']
|
|
821
|
-
assert_equal "\306\374\313\334\270\354.doc", h.params['filename']
|
|
822
828
|
|
|
829
|
+
expected = "\306\374\313\334\270\354.doc"
|
|
830
|
+
expected.force_encoding 'EUC-JP' if expected.respond_to? :force_encoding
|
|
831
|
+
|
|
832
|
+
assert_equal expected, h.params['filename']
|
|
833
|
+
|
|
823
834
|
# raw iso2022jp string in value (quoted string)
|
|
824
835
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
825
836
|
%Q<attachment; filename="\e$BF|K\\8l\e(B.doc">)
|
|
826
837
|
assert_equal 'attachment', h.disposition
|
|
827
838
|
assert_equal 1, h.params.size
|
|
828
839
|
# assert_equal "\e$BF|K\\8l\e(B.doc", h.params['filename']
|
|
829
|
-
assert_equal
|
|
840
|
+
assert_equal expected, h.params['filename']
|
|
830
841
|
end
|
|
831
842
|
|
|
832
843
|
def _test_raw_eucjp
|
|
833
|
-
|
|
844
|
+
TMail.KCODE = 'EUC'
|
|
834
845
|
# raw EUC-JP string in value (token)
|
|
835
846
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
836
847
|
%Q<attachment; filename=\306\374\313\334\270\354.doc>)
|
|
837
848
|
assert_equal 'attachment', h.disposition
|
|
838
849
|
assert_equal 1, h.params.size
|
|
839
|
-
|
|
850
|
+
expected = "\306\374\313\334\270\354.doc"
|
|
851
|
+
expected.force_encoding 'EUC-JP' if expected.respond_to? :force_encoding
|
|
852
|
+
assert_equal expected, h.params['filename']
|
|
840
853
|
|
|
841
854
|
# raw EUC-JP string in value (quoted-string)
|
|
842
855
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
843
856
|
%Q<attachment; filename="\306\374\313\334\270\354.doc">)
|
|
844
857
|
assert_equal 'attachment', h.disposition
|
|
845
858
|
assert_equal 1, h.params.size
|
|
846
|
-
assert_equal
|
|
859
|
+
assert_equal expected, h.params['filename']
|
|
847
860
|
end
|
|
848
861
|
|
|
849
862
|
def _test_raw_sjis
|
|
850
|
-
|
|
863
|
+
TMail.KCODE = 'SJIS'
|
|
851
864
|
# raw SJIS string in value (token)
|
|
852
865
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
853
866
|
%Q<attachment; filename=\223\372\226{\214\352.doc>)
|
|
854
867
|
assert_equal 'attachment', h.disposition
|
|
855
868
|
assert_equal 1, h.params.size
|
|
856
|
-
|
|
869
|
+
expected = "\223\372\226{\214\352.doc"
|
|
870
|
+
expected.force_encoding 'Shift_JIS' if expected.respond_to? :force_encoding
|
|
871
|
+
assert_equal expected, h.params['filename']
|
|
857
872
|
|
|
858
873
|
# raw SJIS string in value (quoted-string)
|
|
859
874
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
860
875
|
%Q<attachment; filename="\223\372\226{\214\352.doc">)
|
|
861
876
|
assert_equal 'attachment', h.disposition
|
|
862
877
|
assert_equal 1, h.params.size
|
|
863
|
-
assert_equal
|
|
878
|
+
assert_equal expected, h.params['filename']
|
|
864
879
|
end
|
|
865
880
|
|
|
866
881
|
def _test_code_conversion
|
|
867
|
-
# JIS ->
|
|
868
|
-
|
|
882
|
+
# JIS -> TMail.KCODE auto conversion
|
|
883
|
+
TMail.KCODE = 'EUC'
|
|
869
884
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
870
885
|
%Q<attachment; filename=\e$BF|K\\8l\e(B.doc>)
|
|
871
886
|
assert_equal 'attachment', h.disposition
|
|
872
887
|
assert_equal 1, h.params.size
|
|
873
|
-
|
|
888
|
+
expected = "\306\374\313\334\270\354.doc"
|
|
889
|
+
expected.force_encoding 'EUC-JP' if expected.respond_to? :force_encoding
|
|
890
|
+
assert_equal expected, h.params['filename']
|
|
874
891
|
|
|
875
|
-
|
|
892
|
+
TMail.KCODE = 'SJIS'
|
|
876
893
|
h = TMail::HeaderField.new('Content-Disposition',
|
|
877
894
|
%Q<attachment; filename=\e$BF|K\\8l\e(B.doc>)
|
|
878
895
|
assert_equal 'attachment', h.disposition
|
|
879
896
|
assert_equal 1, h.params.size
|
|
880
|
-
|
|
897
|
+
expected = "\223\372\226{\214\352.doc"
|
|
898
|
+
expected.force_encoding 'Shift_JIS' if expected.respond_to? :force_encoding
|
|
899
|
+
assert_equal expected, h.params['filename']
|
|
881
900
|
end
|
|
882
901
|
|
|
883
902
|
def test_disposition=
|
|
@@ -916,20 +935,24 @@ class ContentDispositionHeaderTester < Test::Unit::TestCase
|
|
|
916
935
|
def test_should_return_the_evelope_sender_when_given_from_without_a_colon
|
|
917
936
|
p = TMail::FilePort.new("#{File.dirname(__FILE__)}/fixtures/mailbox")
|
|
918
937
|
h = TMail::HeaderField.new_from_port(p, 'EnvelopeSender')
|
|
919
|
-
assert_equal("mike@envelope_sender.com.au", h.addrs.
|
|
938
|
+
assert_equal("mike@envelope_sender.com.au", h.addrs.join)
|
|
920
939
|
end
|
|
921
940
|
|
|
922
941
|
def test_new_from_port_should_produce_a_header_object_that_contains_the_right_data
|
|
923
942
|
p = TMail::FilePort.new("#{File.dirname(__FILE__)}/fixtures/mailbox")
|
|
924
943
|
h = TMail::HeaderField.new_from_port(p, 'From')
|
|
925
|
-
assert_equal("Mikel Lindsaar <mikel@from_address.com>", h.addrs.
|
|
944
|
+
assert_equal("Mikel Lindsaar <mikel@from_address.com>", h.addrs.join)
|
|
926
945
|
end
|
|
927
946
|
|
|
928
947
|
def test_unwrapping_a_long_header_field_using_new_from_port
|
|
929
948
|
p = TMail::FilePort.new("#{File.dirname(__FILE__)}/fixtures/mailbox")
|
|
930
|
-
h = TMail::HeaderField.new_from_port(p, '
|
|
931
|
-
line = "
|
|
932
|
-
|
|
949
|
+
h = TMail::HeaderField.new_from_port(p, 'Content-Type')
|
|
950
|
+
line = 'multipart/signed; protocol="application/pkcs7-signature"; boundary=Apple-Mail-42-587703407; micalg=sha1'
|
|
951
|
+
assert(line =~ /multipart\/signed/)
|
|
952
|
+
assert(line =~ /protocol="application\/pkcs7-signature"/)
|
|
953
|
+
assert(line =~ /boundary=Apple-Mail-42-587703407/)
|
|
954
|
+
assert(line =~ /micalg=sha1/)
|
|
955
|
+
assert_equal(line.length, 103)
|
|
933
956
|
end
|
|
934
957
|
|
|
935
958
|
def test_returning_nil_if_there_is_no_match
|