rims 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/CHANGELOG.md +96 -0
- data/ChangeLog +109 -0
- data/Rakefile +8 -4
- data/lib/rims.rb +31 -29
- data/lib/rims/channel.rb +35 -10
- data/lib/rims/cmd.rb +153 -31
- data/lib/rims/error.rb +15 -0
- data/lib/rims/protocol.rb +28 -7
- data/lib/rims/protocol/decoder.rb +763 -469
- data/lib/rims/protocol/parser.rb +316 -181
- data/lib/rims/service.rb +190 -57
- data/lib/rims/test.rb +46 -17
- data/lib/rims/version.rb +1 -1
- data/load_test/Rakefile +3 -1
- data/rims.gemspec +14 -12
- data/test/cmd/test_command.rb +135 -23
- data/test/test_channel.rb +2 -1
- data/test/test_error.rb +33 -1
- data/test/test_lock.rb +4 -4
- data/test/test_passwd.rb +1 -1
- data/test/test_protocol_decoder.rb +733 -75
- data/test/test_protocol_fetch.rb +384 -189
- data/test/test_protocol_request.rb +305 -280
- data/test/test_protocol_search.rb +771 -892
- data/test/test_service.rb +165 -0
- metadata +34 -8
- data/lib/rims/rfc822.rb +0 -463
- data/test/test_rfc822.rb +0 -696
data/lib/rims/service.rb
CHANGED
@@ -118,6 +118,7 @@ module RIMS
|
|
118
118
|
# daemon:
|
119
119
|
# daemonize: true
|
120
120
|
# debug: false
|
121
|
+
# umask: 0037
|
121
122
|
# status_file: rims.pid
|
122
123
|
# server_polling_interval_seconds: 3
|
123
124
|
# server_privileged_user: nobody
|
@@ -157,10 +158,29 @@ module RIMS
|
|
157
158
|
# send_buffer_limit_size: 16384
|
158
159
|
# read_polling_interval_seconds: 1
|
159
160
|
# command_wait_timeout_seconds: 1800
|
161
|
+
# protocol:
|
162
|
+
# line_length_limit: 8192
|
163
|
+
# literal_size_limit: 10485760
|
164
|
+
# command_size_limit: 10485760
|
165
|
+
# charset:
|
166
|
+
# use_default_aliases: true
|
167
|
+
# aliases:
|
168
|
+
# - name: euc-jp
|
169
|
+
# encoding: eucJP-ms
|
170
|
+
# - name: ios-2022-jp
|
171
|
+
# encoding: CP50221
|
172
|
+
# - name: Shift_JIS
|
173
|
+
# encoding: Windows-31J
|
174
|
+
# convert_options:
|
175
|
+
# replace_invalid_byte_sequence: false
|
176
|
+
# replace_undefined_character: true
|
177
|
+
# replaced_mark: "\uFFFD"
|
160
178
|
# drb_services:
|
161
179
|
# process_num: 4
|
180
|
+
# load_limit: 134217728
|
162
181
|
# engine:
|
163
182
|
# bulk_response_count: 100
|
183
|
+
# bulk_response_size: 33554432
|
164
184
|
# read_lock_timeout_seconds: 30
|
165
185
|
# write_lock_timeout_seconds: 30
|
166
186
|
# cleanup_write_lock_timeout_seconds: 1
|
@@ -385,9 +405,8 @@ module RIMS
|
|
385
405
|
end
|
386
406
|
|
387
407
|
def daemonize?
|
388
|
-
|
389
|
-
|
390
|
-
daemon_config['daemonize']
|
408
|
+
if (@config.dig('daemon')&.key? 'daemonize') then
|
409
|
+
@config.dig('daemon', 'daemonize')
|
391
410
|
else
|
392
411
|
true
|
393
412
|
end
|
@@ -398,14 +417,17 @@ module RIMS
|
|
398
417
|
end
|
399
418
|
|
400
419
|
def daemon_debug?
|
401
|
-
|
402
|
-
|
403
|
-
daemon_config['debug']
|
420
|
+
if (@config.dig('daemon')&.key? 'debug') then
|
421
|
+
@config.dig('daemon', 'debug')
|
404
422
|
else
|
405
423
|
false
|
406
424
|
end
|
407
425
|
end
|
408
426
|
|
427
|
+
def daemon_umask
|
428
|
+
@config.dig('daemon', 'umask') || 0037
|
429
|
+
end
|
430
|
+
|
409
431
|
def status_file
|
410
432
|
file_path = @config.dig('daemon', 'status_file') || 'rims.pid'
|
411
433
|
file_path = Pathname(file_path)
|
@@ -521,22 +543,20 @@ module RIMS
|
|
521
543
|
end
|
522
544
|
|
523
545
|
def ssl_context
|
524
|
-
if (
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
end
|
530
|
-
|
531
|
-
if (use_ssl) then
|
532
|
-
ssl_context = OpenSSL::SSL::SSLContext.new
|
533
|
-
if (ssl_config_expr = openssl_config['ssl_context']) then
|
534
|
-
anon_mod = SSLContextConfigAttribute.new_module(ssl_context, base_dir)
|
535
|
-
SSLContextConfigAttribute.eval_config(anon_mod, ssl_config_expr, 'ssl_context')
|
536
|
-
end
|
546
|
+
if (@config.dig('openssl')&.key? 'use_ssl') then
|
547
|
+
use_ssl = @config.dig('openssl', 'use_ssl')
|
548
|
+
else
|
549
|
+
use_ssl = (@config.dig('openssl')&.key? 'ssl_context') || false
|
550
|
+
end
|
537
551
|
|
538
|
-
|
552
|
+
if (use_ssl) then
|
553
|
+
ssl_context = OpenSSL::SSL::SSLContext.new
|
554
|
+
if (ssl_config_expr = @config.dig('openssl', 'ssl_context')) then
|
555
|
+
anon_mod = SSLContextConfigAttribute.new_module(ssl_context, base_dir)
|
556
|
+
SSLContextConfigAttribute.eval_config(anon_mod, ssl_config_expr, 'ssl_context')
|
539
557
|
end
|
558
|
+
|
559
|
+
ssl_context
|
540
560
|
end
|
541
561
|
end
|
542
562
|
|
@@ -551,14 +571,102 @@ module RIMS
|
|
551
571
|
@config.dig('connection', 'command_wait_timeout_seconds') || 60 * 30)
|
552
572
|
end
|
553
573
|
|
574
|
+
def protocol_line_length_limit
|
575
|
+
@config.dig('protocol', 'line_length_limit') || 1024 * 8
|
576
|
+
end
|
577
|
+
|
578
|
+
def protocol_literal_size_limit
|
579
|
+
@config.dig('protocol', 'literal_size_limit') || 1024**2 * 10
|
580
|
+
end
|
581
|
+
|
582
|
+
def protocol_command_size_limit
|
583
|
+
@config.dig('protocol', 'command_size_limit') || 1024**2 * 10
|
584
|
+
end
|
585
|
+
|
586
|
+
def charset_aliases
|
587
|
+
charset_aliases = RFC822::CharsetAliases.new
|
588
|
+
|
589
|
+
if (@config.dig('charset')&.key? 'use_default_aliases') then
|
590
|
+
use_default_aliases = @config.dig('charset', 'use_default_aliases')
|
591
|
+
else
|
592
|
+
use_default_aliases = true
|
593
|
+
end
|
594
|
+
|
595
|
+
if (use_default_aliases) then
|
596
|
+
for name, encoding in RFC822::DEFAULT_CHARSET_ALIASES
|
597
|
+
charset_aliases.add_alias(name, encoding)
|
598
|
+
end
|
599
|
+
end
|
600
|
+
|
601
|
+
if (alias_list = @config.dig('charset', 'aliases')) then
|
602
|
+
for an_alias in alias_list
|
603
|
+
charset_aliases.add_alias(an_alias['name'], Encoding.find(an_alias['encoding']))
|
604
|
+
end
|
605
|
+
end
|
606
|
+
|
607
|
+
charset_aliases
|
608
|
+
end
|
609
|
+
|
610
|
+
def charset_convert_options
|
611
|
+
options = {}
|
612
|
+
|
613
|
+
if (@config.dig('charset', 'convert_options')&.key? 'replace_invalid_byte_sequence') then
|
614
|
+
replace_invalid_byte_sequence = @config.dig('charset', 'convert_options', 'replace_invalid_byte_sequence')
|
615
|
+
else
|
616
|
+
replace_invalid_byte_sequence = false
|
617
|
+
end
|
618
|
+
|
619
|
+
if (replace_invalid_byte_sequence) then
|
620
|
+
options[:invalid] = :replace
|
621
|
+
end
|
622
|
+
|
623
|
+
if (@config.dig('charset', 'convert_options')&.key? 'replace_undefined_character') then
|
624
|
+
replace_undefined_character = @config.dig('charset', 'convert_options', 'replace_undefined_character')
|
625
|
+
else
|
626
|
+
replace_undefined_character = true
|
627
|
+
end
|
628
|
+
|
629
|
+
if (replace_undefined_character) then
|
630
|
+
options[:undef] = :replace
|
631
|
+
end
|
632
|
+
|
633
|
+
if (replaced_mark = @config.dig('charset', 'convert_options', 'replaced_mark')) then
|
634
|
+
options[:replace] = replaced_mark
|
635
|
+
end
|
636
|
+
|
637
|
+
options
|
638
|
+
end
|
639
|
+
|
554
640
|
def drb_process_num
|
555
641
|
@config.dig('drb_services', 'process_num') || 0
|
556
642
|
end
|
557
643
|
|
644
|
+
def drb_server_config
|
645
|
+
config = {}
|
646
|
+
if (load_limit = @config.dig('drb_services', 'load_limit')) then
|
647
|
+
config[:load_limit] = load_limit
|
648
|
+
end
|
649
|
+
|
650
|
+
config
|
651
|
+
end
|
652
|
+
|
653
|
+
def drb_client_config
|
654
|
+
config = {}
|
655
|
+
if (load_limit = @config.dig('drb_services', 'load_limit')) then
|
656
|
+
config[:load_limit] = load_limit
|
657
|
+
end
|
658
|
+
|
659
|
+
config
|
660
|
+
end
|
661
|
+
|
558
662
|
def bulk_response_count
|
559
663
|
@config.dig('drb_services', 'engine', 'bulk_response_count') || 100
|
560
664
|
end
|
561
665
|
|
666
|
+
def bulk_response_size
|
667
|
+
@config.dig('drb_services', 'engine', 'bulk_response_size') || 1024**2 * 10
|
668
|
+
end
|
669
|
+
|
562
670
|
def read_lock_timeout_seconds
|
563
671
|
@config.dig('drb_services', 'engine', 'read_lock_timeout_seconds') ||
|
564
672
|
@config.dig('read_lock_timeout_seconds') || # for backward compatibility
|
@@ -639,8 +747,8 @@ module RIMS
|
|
639
747
|
end
|
640
748
|
|
641
749
|
def make_authentication
|
642
|
-
if (
|
643
|
-
auth_conf = @config
|
750
|
+
if (@config.dig('authentication')&.is_a? Hash) then
|
751
|
+
auth_conf = @config.dig('authentication')
|
644
752
|
else
|
645
753
|
auth_conf = {}
|
646
754
|
end
|
@@ -679,8 +787,8 @@ module RIMS
|
|
679
787
|
end
|
680
788
|
|
681
789
|
# for backward compatibility
|
682
|
-
if (
|
683
|
-
plug_in_list = @config
|
790
|
+
if (@config.dig('authentication')&.is_a? Array) then
|
791
|
+
plug_in_list = @config.dig('authentication')
|
684
792
|
for plug_in_conf in plug_in_list
|
685
793
|
plug_in_name = plug_in_conf['plug_in'] or raise KeyError, 'not found an authentication plug_in.'
|
686
794
|
plug_in_config = get_configuration(plug_in_conf)
|
@@ -717,16 +825,16 @@ module RIMS
|
|
717
825
|
using Logger::JointPlus
|
718
826
|
|
719
827
|
def setup(server, daemon: false)
|
720
|
-
file_logger_params = @config.make_file_logger_params
|
721
|
-
logger = Logger.new(*file_logger_params)
|
828
|
+
*file_logger_params, file_logger_opts = @config.make_file_logger_params
|
829
|
+
logger = Logger.new(*file_logger_params, **file_logger_opts)
|
722
830
|
|
723
|
-
stdout_logger_params = @config.make_stdout_logger_params
|
831
|
+
*stdout_logger_params, stdout_logger_opts = @config.make_stdout_logger_params
|
724
832
|
unless (daemon && @config.daemonize?) then
|
725
|
-
logger += Logger.new(*stdout_logger_params)
|
833
|
+
logger += Logger.new(*stdout_logger_params, **stdout_logger_opts)
|
726
834
|
end
|
727
835
|
|
728
|
-
protocol_logger_params = @config.make_protocol_logger_params
|
729
|
-
protocol_logger = Logger.new(*protocol_logger_params)
|
836
|
+
*protocol_logger_params, protocol_logger_opts = @config.make_protocol_logger_params
|
837
|
+
protocol_logger = Logger.new(*protocol_logger_params, **protocol_logger_opts)
|
730
838
|
|
731
839
|
logger.info('preload libraries.')
|
732
840
|
Riser.preload
|
@@ -780,22 +888,27 @@ module RIMS
|
|
780
888
|
end
|
781
889
|
end
|
782
890
|
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
891
|
+
drb_services = Riser::DRbServices.new(drb_process_num,
|
892
|
+
server_config: @config.drb_server_config,
|
893
|
+
client_config: @config.drb_client_config)
|
894
|
+
drb_services.add_sticky_process_service(:engine,
|
895
|
+
Riser::ResourceSet.build{|builder|
|
896
|
+
builder.at_create{|unique_user_id|
|
897
|
+
mail_store = MailStore.build(unique_user_id, kvs_meta_open, kvs_text_open)
|
898
|
+
Protocol::Decoder::Engine.new(unique_user_id, mail_store, logger,
|
899
|
+
bulk_response_count: @config.bulk_response_count,
|
900
|
+
bulk_response_size: @config.bulk_response_size,
|
901
|
+
read_lock_timeout_seconds: @config.read_lock_timeout_seconds,
|
902
|
+
write_lock_timeout_seconds: @config.write_lock_timeout_seconds,
|
903
|
+
cleanup_write_lock_timeout_seconds: @config.cleanup_write_lock_timeout_seconds,
|
904
|
+
charset_aliases: @config.charset_aliases,
|
905
|
+
charset_convert_options: @config.charset_convert_options)
|
906
|
+
}
|
907
|
+
builder.at_destroy{|engine|
|
908
|
+
engine.destroy
|
909
|
+
}
|
910
|
+
builder.alias_unref(:destroy)
|
911
|
+
})
|
799
912
|
|
800
913
|
server.before_start{|server_socket|
|
801
914
|
logger.info('start server.')
|
@@ -806,17 +919,17 @@ module RIMS
|
|
806
919
|
file_logger_params[1..-2].each_with_index do |value, i|
|
807
920
|
logger.info("file logging parameter: shift_args[#{i}]=#{value}")
|
808
921
|
end
|
809
|
-
for name, value in
|
922
|
+
for name, value in file_logger_opts
|
810
923
|
logger.info("file logging parameter: #{name}=#{value}")
|
811
924
|
end
|
812
|
-
for name, value in
|
925
|
+
for name, value in stdout_logger_opts
|
813
926
|
logger.info("stdout logging parameter: #{name}=#{value}")
|
814
927
|
end
|
815
928
|
logger.info("protocol logging parameter: path=#{protocol_logger_params[0]}")
|
816
929
|
protocol_logger_params[1..-2].each_with_index do |value, i|
|
817
930
|
logger.info("protocol logging parameter: shift_args[#{i}]=#{value}")
|
818
931
|
end
|
819
|
-
for name, value in
|
932
|
+
for name, value in protocol_logger_opts
|
820
933
|
logger.info("protocol logging parameter: #{name}=#{value}")
|
821
934
|
end
|
822
935
|
logger.info("listen address: #{server_socket.local_address.inspect_sockaddr}")
|
@@ -895,22 +1008,38 @@ module RIMS
|
|
895
1008
|
logger.info("connection parameter: send_buffer_limit_size=#{@config.send_buffer_limit_size}")
|
896
1009
|
logger.info("connection parameter: read_polling_interval_seconds=#{conn_limits.read_polling_interval_seconds}")
|
897
1010
|
logger.info("connection parameter: command_wait_timeout_seconds=#{conn_limits.command_wait_timeout_seconds}")
|
1011
|
+
logger.info("protocol parameter: line_length_limit=#{@config.protocol_line_length_limit}")
|
1012
|
+
logger.info("protocol parameter: literal_size_limit=#{@config.protocol_literal_size_limit}")
|
1013
|
+
logger.info("protocol parameter: command_size_limit=#{@config.protocol_command_size_limit}")
|
1014
|
+
@config.charset_aliases.each_with_index do |(name, enc), i|
|
1015
|
+
logger.info("charset aliases parameter: alias[#{i}]: #{name} -> #{enc.name}")
|
1016
|
+
end
|
1017
|
+
for name, value in @config.charset_convert_options
|
1018
|
+
logger.info("charset convert_options parameter: #{name}=#{value}")
|
1019
|
+
end
|
898
1020
|
logger.info("drb_services parameter: process_num=#{drb_process_num}")
|
1021
|
+
for name, value in @config.drb_server_config
|
1022
|
+
logger.info("drb_services server config parameter: #{name}=#{value}")
|
1023
|
+
end
|
1024
|
+
for name, value in @config.drb_client_config
|
1025
|
+
logger.info("drb_services client config parameter: #{name}=#{value}")
|
1026
|
+
end
|
899
1027
|
logger.info("drb_services engine parameter: bulk_response_count=#{@config.bulk_response_count}")
|
900
|
-
logger.info("
|
901
|
-
logger.info("
|
902
|
-
logger.info("
|
1028
|
+
logger.info("drb_services engine parameter: bulk_response_size=#{@config.bulk_response_size}")
|
1029
|
+
logger.info("drb_services engine parameter: read_lock_timeout_seconds=#{@config.read_lock_timeout_seconds}")
|
1030
|
+
logger.info("drb_services engine parameter: write_lock_timeout_seconds=#{@config.write_lock_timeout_seconds}")
|
1031
|
+
logger.info("drb_services engine parameter: cleanup_write_lock_timeout_seconds=#{@config.cleanup_write_lock_timeout_seconds}")
|
903
1032
|
kvs_meta_log.call
|
904
1033
|
kvs_text_log.call
|
905
1034
|
logger.info("authentication parameter: hostname=#{auth.hostname}")
|
906
1035
|
logger.info("authorization parameter: mail_delivery_user=#{@config.mail_delivery_user}")
|
907
1036
|
|
908
1037
|
logger.info('dRuby services: start server.')
|
909
|
-
|
1038
|
+
drb_services.start_server
|
910
1039
|
}
|
911
1040
|
server.at_fork{
|
912
1041
|
logger.info('dRuby services: detach server.')
|
913
|
-
|
1042
|
+
drb_services.detach_server
|
914
1043
|
}
|
915
1044
|
server.at_stop{|stop_state|
|
916
1045
|
case (stop_state)
|
@@ -926,7 +1055,7 @@ module RIMS
|
|
926
1055
|
}
|
927
1056
|
server.preprocess{
|
928
1057
|
logger.info('dRuby services: start client.')
|
929
|
-
|
1058
|
+
drb_services.start_client
|
930
1059
|
auth.start_plug_in(logger)
|
931
1060
|
}
|
932
1061
|
server.dispatch{|socket|
|
@@ -947,7 +1076,11 @@ module RIMS
|
|
947
1076
|
stream = Riser::WriteBufferStream.new(socket, @config.send_buffer_limit_size)
|
948
1077
|
end
|
949
1078
|
stream = Riser::LoggingStream.new(stream, protocol_logger)
|
950
|
-
decoder = Protocol::Decoder.new_decoder(
|
1079
|
+
decoder = Protocol::Decoder.new_decoder(drb_services, auth, logger,
|
1080
|
+
mail_delivery_user: @config.mail_delivery_user,
|
1081
|
+
line_length_limit: @config.protocol_line_length_limit,
|
1082
|
+
literal_size_limit: @config.protocol_literal_size_limit,
|
1083
|
+
command_size_limit: @config.protocol_command_size_limit)
|
951
1084
|
Protocol::Decoder.repl(decoder, conn_limits, stream, stream, logger)
|
952
1085
|
ensure
|
953
1086
|
if (stream) then
|
@@ -980,7 +1113,7 @@ module RIMS
|
|
980
1113
|
}
|
981
1114
|
server.after_stop{
|
982
1115
|
logger.info('dRuby services: stop server.')
|
983
|
-
|
1116
|
+
drb_services.stop_server
|
984
1117
|
logger.info('stop server.')
|
985
1118
|
}
|
986
1119
|
|
data/lib/rims/test.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
+
require 'digest'
|
3
4
|
require 'fileutils'
|
4
5
|
require 'set'
|
5
6
|
|
@@ -37,8 +38,7 @@ module RIMS
|
|
37
38
|
module_function :message_data_list
|
38
39
|
|
39
40
|
def make_body(description)
|
40
|
-
|
41
|
-
reader.parse(reader.scan_line(description))[0]
|
41
|
+
RIMS::Protocol::RequestReader.parse(RIMS::Protocol::RequestReader.scan(description))[0]
|
42
42
|
end
|
43
43
|
private :make_body
|
44
44
|
|
@@ -67,23 +67,30 @@ module RIMS
|
|
67
67
|
end
|
68
68
|
|
69
69
|
module ProtocolFetchMailSample
|
70
|
-
|
71
|
-
|
70
|
+
simple_mail_body = <<-'EOF'.freeze
|
71
|
+
Hello world.
|
72
|
+
EOF
|
73
|
+
|
74
|
+
MAIL_SIMPLE_TEXT = (<<-"EOF" + simple_mail_body).freeze
|
72
75
|
To: foo@nonet.org
|
73
76
|
From: bar@nonet.org
|
74
77
|
Subject: test
|
75
78
|
MIME-Version: 1.0
|
76
79
|
Content-Type: text/plain; charset=us-ascii
|
77
80
|
Content-Transfer-Encoding: 7bit
|
81
|
+
Content-MD5: #{[ Digest::MD5.digest(simple_mail_body) ].pack('m').strip}
|
82
|
+
Content-Language: en-US, en
|
78
83
|
Date: Fri, 8 Nov 2013 06:47:50 +0900 (JST)
|
79
84
|
|
80
|
-
|
81
|
-
|
85
|
+
EOF
|
86
|
+
|
87
|
+
def make_mail_simple
|
88
|
+
@simple_mail = RIMS::RFC822::Message.new(MAIL_SIMPLE_TEXT)
|
89
|
+
@simple_mail_body = @simple_mail.body.raw_source
|
82
90
|
end
|
83
91
|
private :make_mail_simple
|
84
92
|
|
85
|
-
|
86
|
-
@mpart_mail = RIMS::RFC822::Message.new(<<-'EOF')
|
93
|
+
MPART_MAIL_TEXT = <<-'EOF'.freeze
|
87
94
|
To: bar@nonet.com
|
88
95
|
From: foo@nonet.com
|
89
96
|
Subject: multipart test
|
@@ -97,6 +104,9 @@ Content-Type: text/plain; charset=us-ascii
|
|
97
104
|
Multipart test.
|
98
105
|
--1383.905529.351297
|
99
106
|
Content-Type: application/octet-stream
|
107
|
+
Content-Disposition: attachment
|
108
|
+
; filename=test.dat
|
109
|
+
; modification-date="Wed, 12 Feb 1997 16:29:51 -0500"
|
100
110
|
|
101
111
|
0123456789
|
102
112
|
--1383.905529.351297
|
@@ -108,6 +118,9 @@ Subject: inner multipart
|
|
108
118
|
MIME-Version: 1.0
|
109
119
|
Date: Fri, 8 Nov 2013 19:31:03 +0900
|
110
120
|
Content-Type: multipart/mixed; boundary="1383.905529.351298"
|
121
|
+
Content-Disposition: attachment; filename=hello.txt
|
122
|
+
Content-Language: en
|
123
|
+
Content-Location: test
|
111
124
|
|
112
125
|
--1383.905529.351298
|
113
126
|
Content-Type: text/plain; charset=us-ascii
|
@@ -123,7 +136,9 @@ Content-Type: multipart/mixed; boundary="1383.905529.351299"
|
|
123
136
|
|
124
137
|
--1383.905529.351299
|
125
138
|
Content-Type: image/gif
|
139
|
+
Content-Disposition: inline
|
126
140
|
|
141
|
+
GIF image...
|
127
142
|
--1383.905529.351299
|
128
143
|
Content-Type: message/rfc822
|
129
144
|
|
@@ -136,6 +151,7 @@ Content-Type: multipart/mixed; boundary="1383.905529.351300"
|
|
136
151
|
|
137
152
|
--1383.905529.351300
|
138
153
|
Content-Type: text/plain; charset=us-ascii
|
154
|
+
Content-Location: foo
|
139
155
|
|
140
156
|
HALO
|
141
157
|
--1383.905529.351300
|
@@ -143,10 +159,12 @@ Content-Type: multipart/alternative; boundary="1383.905529.351301"
|
|
143
159
|
|
144
160
|
--1383.905529.351301
|
145
161
|
Content-Type: text/plain; charset=us-ascii
|
162
|
+
Content-Location: bar
|
146
163
|
|
147
164
|
alternative message.
|
148
165
|
--1383.905529.351301
|
149
166
|
Content-Type: text/html; charset=us-ascii
|
167
|
+
Content-Location: baz
|
150
168
|
|
151
169
|
<html>
|
152
170
|
<body><p>HTML message</p></body>
|
@@ -155,12 +173,14 @@ Content-Type: text/html; charset=us-ascii
|
|
155
173
|
--1383.905529.351300--
|
156
174
|
--1383.905529.351299--
|
157
175
|
--1383.905529.351297--
|
158
|
-
|
176
|
+
EOF
|
177
|
+
|
178
|
+
def make_mail_multipart
|
179
|
+
@mpart_mail = RIMS::RFC822::Message.new(MPART_MAIL_TEXT)
|
159
180
|
end
|
160
181
|
private :make_mail_multipart
|
161
182
|
|
162
|
-
|
163
|
-
@mime_subject_mail = RIMS::RFC822::Message.new(<<-'EOF')
|
183
|
+
MAIL_MIME_SUBJECT_TEXT = <<-'EOF'.freeze
|
164
184
|
Date: Fri, 8 Nov 2013 19:31:03 +0900
|
165
185
|
Subject: =?ISO-2022-JP?B?GyRCJEYkOSRIGyhC?=
|
166
186
|
From: foo@nonet.com, bar <bar@nonet.com>
|
@@ -176,22 +196,28 @@ In-Reply-To: <20131106081723.5KJU1774292@smtp.test.com>
|
|
176
196
|
Message-Id: <20131107214750.445A1255B9F@smtp.nonet.com>
|
177
197
|
|
178
198
|
Hello world.
|
179
|
-
|
199
|
+
EOF
|
200
|
+
|
201
|
+
def make_mail_mime_subject
|
202
|
+
@mime_subject_mail = RIMS::RFC822::Message.new(MAIL_MIME_SUBJECT_TEXT)
|
180
203
|
end
|
181
204
|
private :make_mail_mime_subject
|
182
205
|
|
206
|
+
MAIL_EMPTY_TEXT = ''.freeze
|
207
|
+
|
183
208
|
def make_mail_empty
|
184
|
-
@empty_mail = RIMS::RFC822::Message.new(
|
209
|
+
@empty_mail = RIMS::RFC822::Message.new(MAIL_EMPTY_TEXT)
|
185
210
|
end
|
186
211
|
private :make_mail_empty
|
187
212
|
|
213
|
+
MAIL_NO_BODY_TEXT = "Subject: foo\r\n\r\n".freeze
|
214
|
+
|
188
215
|
def make_mail_no_body
|
189
|
-
@no_body_mail = RIMS::RFC822::Message.new(
|
216
|
+
@no_body_mail = RIMS::RFC822::Message.new(MAIL_NO_BODY_TEXT)
|
190
217
|
end
|
191
218
|
private :make_mail_no_body
|
192
219
|
|
193
|
-
|
194
|
-
@address_header_pattern_mail = RIMS::RFC822::Message.new(<<-'EOF')
|
220
|
+
MAIL_ADDRESS_HEADER_PATTERN_TEXT = <<-'EOF'.freeze
|
195
221
|
To: "foo@nonet.org" <foo@nonet.org>
|
196
222
|
From: bar@nonet.org
|
197
223
|
Subject: test
|
@@ -201,7 +227,10 @@ Content-Transfer-Encoding: 7bit
|
|
201
227
|
Date: Fri, 8 Nov 2013 06:47:50 +0900 (JST)
|
202
228
|
|
203
229
|
Hello world.
|
204
|
-
EOF
|
230
|
+
EOF
|
231
|
+
|
232
|
+
def make_mail_address_header_pattern
|
233
|
+
@address_header_pattern_mail = RIMS::RFC822::Message.new(MAIL_ADDRESS_HEADER_PATTERN_TEXT)
|
205
234
|
end
|
206
235
|
private :make_mail_address_header_pattern
|
207
236
|
end
|