mail 2.6.1 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +5 -5
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +92 -80
  4. data/lib/mail/attachments_list.rb +11 -5
  5. data/lib/mail/body.rb +81 -44
  6. data/lib/mail/check_delivery_params.rb +50 -10
  7. data/lib/mail/configuration.rb +3 -0
  8. data/lib/mail/{patterns.rb → constants.rb} +26 -6
  9. data/lib/mail/core_extensions/smtp.rb +20 -16
  10. data/lib/mail/core_extensions/string.rb +1 -27
  11. data/lib/mail/elements/address.rb +81 -93
  12. data/lib/mail/elements/address_list.rb +12 -29
  13. data/lib/mail/elements/content_disposition_element.rb +9 -15
  14. data/lib/mail/elements/content_location_element.rb +8 -12
  15. data/lib/mail/elements/content_transfer_encoding_element.rb +6 -10
  16. data/lib/mail/elements/content_type_element.rb +9 -19
  17. data/lib/mail/elements/date_time_element.rb +7 -14
  18. data/lib/mail/elements/envelope_from_element.rb +15 -21
  19. data/lib/mail/elements/message_ids_element.rb +12 -14
  20. data/lib/mail/elements/mime_version_element.rb +7 -14
  21. data/lib/mail/elements/phrase_list.rb +7 -9
  22. data/lib/mail/elements/received_element.rb +10 -15
  23. data/lib/mail/elements.rb +1 -0
  24. data/lib/mail/encodings/7bit.rb +6 -15
  25. data/lib/mail/encodings/8bit.rb +5 -18
  26. data/lib/mail/encodings/base64.rb +15 -10
  27. data/lib/mail/encodings/binary.rb +4 -22
  28. data/lib/mail/encodings/identity.rb +24 -0
  29. data/lib/mail/encodings/quoted_printable.rb +13 -7
  30. data/lib/mail/encodings/transfer_encoding.rb +47 -28
  31. data/lib/mail/encodings/unix_to_unix.rb +20 -0
  32. data/lib/mail/encodings.rb +121 -82
  33. data/lib/mail/envelope.rb +2 -1
  34. data/lib/mail/field.rb +114 -62
  35. data/lib/mail/field_list.rb +2 -1
  36. data/lib/mail/fields/bcc_field.rb +17 -5
  37. data/lib/mail/fields/cc_field.rb +2 -2
  38. data/lib/mail/fields/comments_field.rb +2 -1
  39. data/lib/mail/fields/common/address_container.rb +3 -2
  40. data/lib/mail/fields/common/common_address.rb +40 -14
  41. data/lib/mail/fields/common/common_date.rb +2 -1
  42. data/lib/mail/fields/common/common_field.rb +6 -11
  43. data/lib/mail/fields/common/common_message_id.rb +3 -2
  44. data/lib/mail/fields/common/parameter_hash.rb +5 -4
  45. data/lib/mail/fields/content_description_field.rb +2 -1
  46. data/lib/mail/fields/content_disposition_field.rb +14 -13
  47. data/lib/mail/fields/content_id_field.rb +5 -4
  48. data/lib/mail/fields/content_location_field.rb +3 -2
  49. data/lib/mail/fields/content_transfer_encoding_field.rb +3 -2
  50. data/lib/mail/fields/content_type_field.rb +7 -11
  51. data/lib/mail/fields/date_field.rb +4 -4
  52. data/lib/mail/fields/from_field.rb +2 -2
  53. data/lib/mail/fields/in_reply_to_field.rb +2 -1
  54. data/lib/mail/fields/keywords_field.rb +3 -3
  55. data/lib/mail/fields/message_id_field.rb +3 -2
  56. data/lib/mail/fields/mime_version_field.rb +4 -3
  57. data/lib/mail/fields/optional_field.rb +5 -1
  58. data/lib/mail/fields/received_field.rb +5 -4
  59. data/lib/mail/fields/references_field.rb +2 -1
  60. data/lib/mail/fields/reply_to_field.rb +2 -2
  61. data/lib/mail/fields/resent_bcc_field.rb +2 -2
  62. data/lib/mail/fields/resent_cc_field.rb +2 -2
  63. data/lib/mail/fields/resent_date_field.rb +2 -2
  64. data/lib/mail/fields/resent_from_field.rb +2 -2
  65. data/lib/mail/fields/resent_message_id_field.rb +2 -1
  66. data/lib/mail/fields/resent_sender_field.rb +2 -2
  67. data/lib/mail/fields/resent_to_field.rb +2 -2
  68. data/lib/mail/fields/return_path_field.rb +2 -2
  69. data/lib/mail/fields/sender_field.rb +2 -2
  70. data/lib/mail/fields/structured_field.rb +1 -0
  71. data/lib/mail/fields/subject_field.rb +2 -1
  72. data/lib/mail/fields/to_field.rb +2 -2
  73. data/lib/mail/fields/unstructured_field.rb +28 -10
  74. data/lib/mail/fields.rb +1 -0
  75. data/lib/mail/header.rb +18 -14
  76. data/lib/mail/indifferent_hash.rb +1 -0
  77. data/lib/mail/mail.rb +6 -11
  78. data/lib/mail/matchers/attachment_matchers.rb +29 -0
  79. data/lib/mail/matchers/has_sent_mail.rb +53 -9
  80. data/lib/mail/message.rb +99 -89
  81. data/lib/mail/multibyte/chars.rb +32 -30
  82. data/lib/mail/multibyte/unicode.rb +31 -26
  83. data/lib/mail/multibyte/utils.rb +1 -0
  84. data/lib/mail/multibyte.rb +65 -15
  85. data/lib/mail/network/delivery_methods/exim.rb +7 -10
  86. data/lib/mail/network/delivery_methods/file_delivery.rb +5 -8
  87. data/lib/mail/network/delivery_methods/logger_delivery.rb +37 -0
  88. data/lib/mail/network/delivery_methods/sendmail.rb +17 -11
  89. data/lib/mail/network/delivery_methods/smtp.rb +60 -53
  90. data/lib/mail/network/delivery_methods/smtp_connection.rb +11 -6
  91. data/lib/mail/network/delivery_methods/test_mailer.rb +6 -8
  92. data/lib/mail/network/retriever_methods/base.rb +1 -0
  93. data/lib/mail/network/retriever_methods/imap.rb +19 -5
  94. data/lib/mail/network/retriever_methods/pop3.rb +4 -1
  95. data/lib/mail/network/retriever_methods/test_retriever.rb +2 -1
  96. data/lib/mail/network.rb +2 -0
  97. data/lib/mail/parser_tools.rb +15 -0
  98. data/lib/mail/parsers/address_lists_parser.rb +33208 -104
  99. data/lib/mail/parsers/address_lists_parser.rl +172 -0
  100. data/lib/mail/parsers/content_disposition_parser.rb +877 -49
  101. data/lib/mail/parsers/content_disposition_parser.rl +82 -0
  102. data/lib/mail/parsers/content_location_parser.rb +804 -23
  103. data/lib/mail/parsers/content_location_parser.rl +71 -0
  104. data/lib/mail/parsers/content_transfer_encoding_parser.rb +502 -19
  105. data/lib/mail/parsers/content_transfer_encoding_parser.rl +64 -0
  106. data/lib/mail/parsers/content_type_parser.rb +1024 -46
  107. data/lib/mail/parsers/content_type_parser.rl +83 -0
  108. data/lib/mail/parsers/date_time_parser.rb +872 -23
  109. data/lib/mail/parsers/date_time_parser.rl +62 -0
  110. data/lib/mail/parsers/envelope_from_parser.rb +3570 -34
  111. data/lib/mail/parsers/envelope_from_parser.rl +82 -0
  112. data/lib/mail/parsers/message_ids_parser.rb +2840 -25
  113. data/lib/mail/parsers/message_ids_parser.rl +82 -0
  114. data/lib/mail/parsers/mime_version_parser.rb +492 -26
  115. data/lib/mail/parsers/mime_version_parser.rl +61 -0
  116. data/lib/mail/parsers/phrase_lists_parser.rb +862 -17
  117. data/lib/mail/parsers/phrase_lists_parser.rl +83 -0
  118. data/lib/mail/parsers/received_parser.rb +8765 -36
  119. data/lib/mail/parsers/received_parser.rl +84 -0
  120. data/lib/mail/parsers/rfc2045_content_transfer_encoding.rl +13 -0
  121. data/lib/mail/parsers/rfc2045_content_type.rl +25 -0
  122. data/lib/mail/parsers/rfc2045_mime.rl +16 -0
  123. data/lib/mail/parsers/rfc2183_content_disposition.rl +15 -0
  124. data/lib/mail/parsers/rfc3629_utf8.rl +19 -0
  125. data/lib/mail/parsers/rfc5234_abnf_core_rules.rl +22 -0
  126. data/lib/mail/parsers/rfc5322.rl +59 -0
  127. data/lib/mail/parsers/rfc5322_address.rl +72 -0
  128. data/lib/mail/parsers/{ragel/date_time.rl → rfc5322_date_time.rl} +8 -1
  129. data/lib/mail/parsers/rfc5322_lexical_tokens.rl +60 -0
  130. data/lib/mail/parsers.rb +17 -24
  131. data/lib/mail/part.rb +8 -5
  132. data/lib/mail/parts_list.rb +31 -14
  133. data/lib/mail/utilities.rb +112 -13
  134. data/lib/mail/values/unicode_tables.dat +0 -0
  135. data/lib/mail/version.rb +8 -15
  136. data/lib/mail/version_specific/ruby_1_8.rb +52 -8
  137. data/lib/mail/version_specific/ruby_1_9.rb +143 -24
  138. data/lib/mail.rb +8 -14
  139. metadata +71 -81
  140. data/CHANGELOG.rdoc +0 -752
  141. data/CONTRIBUTING.md +0 -60
  142. data/Dependencies.txt +0 -2
  143. data/Gemfile +0 -15
  144. data/Rakefile +0 -29
  145. data/TODO.rdoc +0 -9
  146. data/VERSION +0 -4
  147. data/lib/mail/core_extensions/nil.rb +0 -19
  148. data/lib/mail/core_extensions/object.rb +0 -13
  149. data/lib/mail/core_extensions/string/access.rb +0 -145
  150. data/lib/mail/core_extensions/string/multibyte.rb +0 -78
  151. data/lib/mail/multibyte/exceptions.rb +0 -8
  152. data/lib/mail/parsers/ragel/common.rl +0 -184
  153. data/lib/mail/parsers/ragel/parser_info.rb +0 -61
  154. data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb +0 -14864
  155. data/lib/mail/parsers/ragel/ruby/machines/address_lists_machine.rb.rl +0 -37
  156. data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb +0 -751
  157. data/lib/mail/parsers/ragel/ruby/machines/content_disposition_machine.rb.rl +0 -37
  158. data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb +0 -614
  159. data/lib/mail/parsers/ragel/ruby/machines/content_location_machine.rb.rl +0 -37
  160. data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb +0 -447
  161. data/lib/mail/parsers/ragel/ruby/machines/content_transfer_encoding_machine.rb.rl +0 -37
  162. data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb +0 -825
  163. data/lib/mail/parsers/ragel/ruby/machines/content_type_machine.rb.rl +0 -37
  164. data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb +0 -817
  165. data/lib/mail/parsers/ragel/ruby/machines/date_time_machine.rb.rl +0 -37
  166. data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb +0 -2129
  167. data/lib/mail/parsers/ragel/ruby/machines/envelope_from_machine.rb.rl +0 -37
  168. data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb +0 -1570
  169. data/lib/mail/parsers/ragel/ruby/machines/message_ids_machine.rb.rl +0 -37
  170. data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb +0 -440
  171. data/lib/mail/parsers/ragel/ruby/machines/mime_version_machine.rb.rl +0 -37
  172. data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb +0 -564
  173. data/lib/mail/parsers/ragel/ruby/machines/phrase_lists_machine.rb.rl +0 -37
  174. data/lib/mail/parsers/ragel/ruby/machines/rb_actions.rl +0 -51
  175. data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb +0 -5144
  176. data/lib/mail/parsers/ragel/ruby/machines/received_machine.rb.rl +0 -37
  177. data/lib/mail/parsers/ragel/ruby/parser.rb.rl.erb +0 -37
  178. data/lib/mail/parsers/ragel/ruby.rb +0 -39
  179. data/lib/mail/parsers/ragel.rb +0 -17
@@ -1,67 +1,895 @@
1
+
2
+ # frozen_string_literal: true
3
+ require "mail/utilities"
4
+ require "mail/parser_tools"
5
+
1
6
  module Mail::Parsers
2
- class ContentDispositionParser
3
- include Mail::Utilities
7
+ module ContentDispositionParser
8
+ extend Mail::ParserTools
4
9
 
5
- def parse(s)
6
- content_disposition = ContentDispositionStruct.new("", nil)
7
- if s.blank?
8
- return content_disposition
9
- end
10
+ ContentDispositionStruct = Struct.new(:disposition_type, :parameters, :error)
10
11
 
11
- actions, error = Ragel.parse(:content_disposition, s)
12
- if error
13
- raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, s, error)
14
- end
12
+ class << self
13
+ attr_accessor :_trans_keys
14
+ private :_trans_keys, :_trans_keys=
15
+ end
16
+ self._trans_keys = [
17
+ 0, 0, 33, 126, 9, 126,
18
+ 10, 10, 9, 32, 33,
19
+ 126, 9, 126, 9, 40,
20
+ 10, 10, 9, 32, 1, 244,
21
+ 1, 244, 10, 10, 9,
22
+ 32, 10, 10, 9, 32,
23
+ 0, 244, 128, 191, 160, 191,
24
+ 128, 191, 128, 159, 144,
25
+ 191, 128, 191, 128, 143,
26
+ 9, 40, 10, 10, 9, 32,
27
+ 9, 126, 1, 244, 1,
28
+ 244, 10, 10, 9, 32,
29
+ 0, 244, 128, 191, 160, 191,
30
+ 128, 191, 128, 159, 144,
31
+ 191, 128, 191, 128, 143,
32
+ 33, 126, 9, 59, 9, 59,
33
+ 9, 126, 9, 59, 9,
34
+ 59, 0, 0, 0,
35
+ ]
36
+
37
+ class << self
38
+ attr_accessor :_key_spans
39
+ private :_key_spans, :_key_spans=
40
+ end
41
+ self._key_spans = [
42
+ 0, 94, 118, 1, 24, 94, 118, 32,
43
+ 1, 24, 244, 244, 1, 24, 1, 24,
44
+ 245, 64, 32, 64, 32, 48, 64, 16,
45
+ 32, 1, 24, 118, 244, 244, 1, 24,
46
+ 245, 64, 32, 64, 32, 48, 64, 16,
47
+ 94, 51, 51, 118, 51, 51, 0,
48
+ ]
49
+
50
+ class << self
51
+ attr_accessor :_index_offsets
52
+ private :_index_offsets, :_index_offsets=
53
+ end
54
+ self._index_offsets = [
55
+ 0, 0, 95, 214, 216, 241, 336, 455,
56
+ 488, 490, 515, 760, 1005, 1007, 1032, 1034,
57
+ 1059, 1305, 1370, 1403, 1468, 1501, 1550, 1615,
58
+ 1632, 1665, 1667, 1692, 1811, 2056, 2301, 2303,
59
+ 2328, 2574, 2639, 2672, 2737, 2770, 2819, 2884,
60
+ 2901, 2996, 3048, 3100, 3219, 3271, 3323,
61
+ ]
62
+
63
+ class << self
64
+ attr_accessor :_indicies
65
+ private :_indicies, :_indicies=
66
+ end
67
+ self._indicies = [
68
+ 0, 0, 0, 0, 0, 0, 0, 1,
69
+ 1, 0, 0, 0, 0, 0, 1, 0,
70
+ 0, 0, 0, 0, 0, 0, 0, 0,
71
+ 0, 1, 1, 1, 1, 1, 1, 1,
72
+ 0, 0, 0, 0, 0, 0, 0, 0,
73
+ 0, 0, 0, 0, 0, 0, 0, 0,
74
+ 0, 0, 0, 0, 0, 0, 0, 0,
75
+ 0, 0, 1, 1, 1, 0, 0, 0,
76
+ 0, 0, 0, 0, 0, 0, 0, 0,
77
+ 0, 0, 0, 0, 0, 0, 0, 0,
78
+ 0, 0, 0, 0, 0, 0, 0, 0,
79
+ 0, 0, 0, 0, 0, 0, 1, 2,
80
+ 1, 1, 1, 3, 1, 1, 1, 1,
81
+ 1, 1, 1, 1, 1, 1, 1, 1,
82
+ 1, 1, 1, 1, 1, 1, 2, 4,
83
+ 4, 4, 4, 4, 4, 4, 5, 1,
84
+ 4, 4, 4, 4, 4, 1, 4, 4,
85
+ 4, 4, 4, 4, 4, 4, 4, 4,
86
+ 1, 1, 1, 1, 1, 1, 1, 4,
87
+ 4, 4, 4, 4, 4, 4, 4, 4,
88
+ 4, 4, 4, 4, 4, 4, 4, 4,
89
+ 4, 4, 4, 4, 4, 4, 4, 4,
90
+ 4, 1, 1, 1, 4, 4, 4, 4,
91
+ 4, 4, 4, 4, 4, 4, 4, 4,
92
+ 4, 4, 4, 4, 4, 4, 4, 4,
93
+ 4, 4, 4, 4, 4, 4, 4, 4,
94
+ 4, 4, 4, 4, 4, 1, 6, 1,
95
+ 2, 1, 1, 1, 1, 1, 1, 1,
96
+ 1, 1, 1, 1, 1, 1, 1, 1,
97
+ 1, 1, 1, 1, 1, 1, 1, 2,
98
+ 1, 7, 7, 7, 7, 7, 7, 7,
99
+ 1, 1, 7, 7, 7, 7, 7, 1,
100
+ 7, 7, 7, 7, 7, 7, 7, 7,
101
+ 7, 7, 1, 1, 1, 8, 1, 1,
102
+ 1, 7, 7, 7, 7, 7, 7, 7,
103
+ 7, 7, 7, 7, 7, 7, 7, 7,
104
+ 7, 7, 7, 7, 7, 7, 7, 7,
105
+ 7, 7, 7, 1, 1, 1, 7, 7,
106
+ 7, 7, 7, 7, 7, 7, 7, 7,
107
+ 7, 7, 7, 7, 7, 7, 7, 7,
108
+ 7, 7, 7, 7, 7, 7, 7, 7,
109
+ 7, 7, 7, 7, 7, 7, 7, 1,
110
+ 9, 1, 1, 1, 10, 1, 1, 1,
111
+ 1, 1, 1, 1, 1, 1, 1, 1,
112
+ 1, 1, 1, 1, 1, 1, 1, 9,
113
+ 11, 12, 11, 11, 11, 11, 11, 13,
114
+ 1, 11, 11, 11, 11, 11, 1, 11,
115
+ 11, 11, 11, 11, 11, 11, 11, 11,
116
+ 11, 1, 1, 1, 11, 1, 1, 1,
117
+ 11, 11, 11, 11, 11, 11, 11, 11,
118
+ 11, 11, 11, 11, 11, 11, 11, 11,
119
+ 11, 11, 11, 11, 11, 11, 11, 11,
120
+ 11, 11, 1, 1, 1, 11, 11, 11,
121
+ 11, 11, 11, 11, 11, 11, 11, 11,
122
+ 11, 11, 11, 11, 11, 11, 11, 11,
123
+ 11, 11, 11, 11, 11, 11, 11, 11,
124
+ 11, 11, 11, 11, 11, 11, 1, 14,
125
+ 1, 1, 1, 15, 1, 1, 1, 1,
126
+ 1, 1, 1, 1, 1, 1, 1, 1,
127
+ 1, 1, 1, 1, 1, 1, 14, 1,
128
+ 16, 1, 1, 1, 1, 1, 17, 1,
129
+ 18, 1, 14, 1, 1, 1, 1, 1,
130
+ 1, 1, 1, 1, 1, 1, 1, 1,
131
+ 1, 1, 1, 1, 1, 1, 1, 1,
132
+ 1, 14, 1, 19, 19, 19, 19, 19,
133
+ 19, 19, 19, 19, 1, 19, 19, 20,
134
+ 19, 19, 19, 19, 19, 19, 19, 19,
135
+ 19, 19, 19, 19, 19, 19, 19, 19,
136
+ 19, 19, 19, 19, 21, 19, 19, 19,
137
+ 19, 19, 19, 19, 19, 19, 19, 19,
138
+ 19, 19, 19, 19, 19, 19, 19, 19,
139
+ 19, 19, 19, 19, 19, 19, 19, 19,
140
+ 19, 19, 19, 19, 19, 19, 19, 19,
141
+ 19, 19, 19, 19, 19, 19, 19, 19,
142
+ 19, 19, 19, 19, 19, 19, 19, 19,
143
+ 19, 19, 19, 19, 19, 19, 22, 19,
144
+ 19, 19, 19, 19, 19, 19, 19, 19,
145
+ 19, 19, 19, 19, 19, 19, 19, 19,
146
+ 19, 19, 19, 19, 19, 19, 19, 19,
147
+ 19, 19, 19, 19, 19, 19, 19, 19,
148
+ 19, 19, 1, 1, 1, 1, 1, 1,
149
+ 1, 1, 1, 1, 1, 1, 1, 1,
150
+ 1, 1, 1, 1, 1, 1, 1, 1,
151
+ 1, 1, 1, 1, 1, 1, 1, 1,
152
+ 1, 1, 1, 1, 1, 1, 1, 1,
153
+ 1, 1, 1, 1, 1, 1, 1, 1,
154
+ 1, 1, 1, 1, 1, 1, 1, 1,
155
+ 1, 1, 1, 1, 1, 1, 1, 1,
156
+ 1, 1, 1, 1, 23, 23, 23, 23,
157
+ 23, 23, 23, 23, 23, 23, 23, 23,
158
+ 23, 23, 23, 23, 23, 23, 23, 23,
159
+ 23, 23, 23, 23, 23, 23, 23, 23,
160
+ 23, 23, 24, 25, 25, 25, 25, 25,
161
+ 25, 25, 25, 25, 25, 25, 25, 26,
162
+ 25, 25, 27, 28, 28, 28, 29, 1,
163
+ 30, 30, 30, 30, 30, 30, 30, 30,
164
+ 30, 1, 30, 30, 31, 30, 30, 30,
165
+ 30, 30, 30, 30, 30, 30, 30, 30,
166
+ 30, 30, 30, 30, 30, 30, 30, 30,
167
+ 30, 32, 30, 30, 30, 30, 30, 30,
168
+ 30, 30, 30, 30, 30, 30, 30, 30,
169
+ 30, 30, 30, 30, 30, 30, 30, 30,
170
+ 30, 30, 30, 30, 30, 30, 30, 30,
171
+ 30, 30, 30, 30, 30, 30, 30, 30,
172
+ 30, 30, 30, 30, 30, 30, 30, 30,
173
+ 30, 30, 30, 30, 30, 30, 30, 30,
174
+ 30, 30, 30, 33, 30, 30, 30, 30,
175
+ 30, 30, 30, 30, 30, 30, 30, 30,
176
+ 30, 30, 30, 30, 30, 30, 30, 30,
177
+ 30, 30, 30, 30, 30, 30, 30, 30,
178
+ 30, 30, 30, 30, 30, 30, 30, 1,
179
+ 1, 1, 1, 1, 1, 1, 1, 1,
180
+ 1, 1, 1, 1, 1, 1, 1, 1,
181
+ 1, 1, 1, 1, 1, 1, 1, 1,
182
+ 1, 1, 1, 1, 1, 1, 1, 1,
183
+ 1, 1, 1, 1, 1, 1, 1, 1,
184
+ 1, 1, 1, 1, 1, 1, 1, 1,
185
+ 1, 1, 1, 1, 1, 1, 1, 1,
186
+ 1, 1, 1, 1, 1, 1, 1, 1,
187
+ 1, 34, 34, 34, 34, 34, 34, 34,
188
+ 34, 34, 34, 34, 34, 34, 34, 34,
189
+ 34, 34, 34, 34, 34, 34, 34, 34,
190
+ 34, 34, 34, 34, 34, 34, 34, 35,
191
+ 36, 36, 36, 36, 36, 36, 36, 36,
192
+ 36, 36, 36, 36, 37, 36, 36, 38,
193
+ 39, 39, 39, 40, 1, 41, 1, 30,
194
+ 1, 1, 1, 1, 1, 1, 1, 1,
195
+ 1, 1, 1, 1, 1, 1, 1, 1,
196
+ 1, 1, 1, 1, 1, 1, 30, 1,
197
+ 42, 1, 43, 1, 1, 1, 1, 1,
198
+ 1, 1, 1, 1, 1, 1, 1, 1,
199
+ 1, 1, 1, 1, 1, 1, 1, 1,
200
+ 1, 43, 1, 30, 30, 30, 30, 30,
201
+ 30, 30, 30, 30, 30, 30, 30, 30,
202
+ 30, 30, 30, 30, 30, 30, 30, 30,
203
+ 30, 30, 30, 30, 30, 30, 30, 30,
204
+ 30, 30, 30, 30, 30, 30, 30, 30,
205
+ 30, 30, 30, 30, 30, 30, 30, 30,
206
+ 30, 30, 30, 30, 30, 30, 30, 30,
207
+ 30, 30, 30, 30, 30, 30, 30, 30,
208
+ 30, 30, 30, 30, 30, 30, 30, 30,
209
+ 30, 30, 30, 30, 30, 30, 30, 30,
210
+ 30, 30, 30, 30, 30, 30, 30, 30,
211
+ 30, 30, 30, 30, 30, 30, 30, 30,
212
+ 30, 30, 30, 30, 30, 30, 30, 30,
213
+ 30, 30, 30, 30, 30, 30, 30, 30,
214
+ 30, 30, 30, 30, 30, 30, 30, 30,
215
+ 30, 30, 30, 30, 30, 30, 30, 30,
216
+ 30, 30, 30, 1, 1, 1, 1, 1,
217
+ 1, 1, 1, 1, 1, 1, 1, 1,
218
+ 1, 1, 1, 1, 1, 1, 1, 1,
219
+ 1, 1, 1, 1, 1, 1, 1, 1,
220
+ 1, 1, 1, 1, 1, 1, 1, 1,
221
+ 1, 1, 1, 1, 1, 1, 1, 1,
222
+ 1, 1, 1, 1, 1, 1, 1, 1,
223
+ 1, 1, 1, 1, 1, 1, 1, 1,
224
+ 1, 1, 1, 1, 1, 34, 34, 34,
225
+ 34, 34, 34, 34, 34, 34, 34, 34,
226
+ 34, 34, 34, 34, 34, 34, 34, 34,
227
+ 34, 34, 34, 34, 34, 34, 34, 34,
228
+ 34, 34, 34, 35, 36, 36, 36, 36,
229
+ 36, 36, 36, 36, 36, 36, 36, 36,
230
+ 37, 36, 36, 38, 39, 39, 39, 40,
231
+ 1, 30, 30, 30, 30, 30, 30, 30,
232
+ 30, 30, 30, 30, 30, 30, 30, 30,
233
+ 30, 30, 30, 30, 30, 30, 30, 30,
234
+ 30, 30, 30, 30, 30, 30, 30, 30,
235
+ 30, 30, 30, 30, 30, 30, 30, 30,
236
+ 30, 30, 30, 30, 30, 30, 30, 30,
237
+ 30, 30, 30, 30, 30, 30, 30, 30,
238
+ 30, 30, 30, 30, 30, 30, 30, 30,
239
+ 30, 1, 34, 34, 34, 34, 34, 34,
240
+ 34, 34, 34, 34, 34, 34, 34, 34,
241
+ 34, 34, 34, 34, 34, 34, 34, 34,
242
+ 34, 34, 34, 34, 34, 34, 34, 34,
243
+ 34, 34, 1, 34, 34, 34, 34, 34,
244
+ 34, 34, 34, 34, 34, 34, 34, 34,
245
+ 34, 34, 34, 34, 34, 34, 34, 34,
246
+ 34, 34, 34, 34, 34, 34, 34, 34,
247
+ 34, 34, 34, 34, 34, 34, 34, 34,
248
+ 34, 34, 34, 34, 34, 34, 34, 34,
249
+ 34, 34, 34, 34, 34, 34, 34, 34,
250
+ 34, 34, 34, 34, 34, 34, 34, 34,
251
+ 34, 34, 34, 1, 34, 34, 34, 34,
252
+ 34, 34, 34, 34, 34, 34, 34, 34,
253
+ 34, 34, 34, 34, 34, 34, 34, 34,
254
+ 34, 34, 34, 34, 34, 34, 34, 34,
255
+ 34, 34, 34, 34, 1, 36, 36, 36,
256
+ 36, 36, 36, 36, 36, 36, 36, 36,
257
+ 36, 36, 36, 36, 36, 36, 36, 36,
258
+ 36, 36, 36, 36, 36, 36, 36, 36,
259
+ 36, 36, 36, 36, 36, 36, 36, 36,
260
+ 36, 36, 36, 36, 36, 36, 36, 36,
261
+ 36, 36, 36, 36, 36, 1, 36, 36,
262
+ 36, 36, 36, 36, 36, 36, 36, 36,
263
+ 36, 36, 36, 36, 36, 36, 36, 36,
264
+ 36, 36, 36, 36, 36, 36, 36, 36,
265
+ 36, 36, 36, 36, 36, 36, 36, 36,
266
+ 36, 36, 36, 36, 36, 36, 36, 36,
267
+ 36, 36, 36, 36, 36, 36, 36, 36,
268
+ 36, 36, 36, 36, 36, 36, 36, 36,
269
+ 36, 36, 36, 36, 36, 36, 1, 36,
270
+ 36, 36, 36, 36, 36, 36, 36, 36,
271
+ 36, 36, 36, 36, 36, 36, 36, 1,
272
+ 44, 1, 1, 1, 45, 1, 1, 1,
273
+ 1, 1, 1, 1, 1, 1, 1, 1,
274
+ 1, 1, 1, 1, 1, 1, 1, 44,
275
+ 1, 46, 1, 1, 1, 1, 1, 47,
276
+ 1, 48, 1, 49, 1, 1, 1, 1,
277
+ 1, 1, 1, 1, 1, 1, 1, 1,
278
+ 1, 1, 1, 1, 1, 1, 1, 1,
279
+ 1, 1, 49, 1, 50, 1, 1, 1,
280
+ 51, 1, 1, 1, 1, 1, 1, 1,
281
+ 1, 1, 1, 1, 1, 1, 1, 1,
282
+ 1, 1, 1, 50, 52, 52, 52, 52,
283
+ 52, 52, 52, 53, 1, 52, 52, 52,
284
+ 52, 52, 1, 52, 52, 52, 52, 52,
285
+ 52, 52, 52, 52, 52, 1, 1, 1,
286
+ 1, 1, 1, 1, 52, 52, 52, 52,
287
+ 52, 52, 52, 52, 52, 52, 52, 52,
288
+ 52, 52, 52, 52, 52, 52, 52, 52,
289
+ 52, 52, 52, 52, 52, 52, 1, 1,
290
+ 1, 52, 52, 52, 52, 52, 52, 52,
291
+ 52, 52, 52, 52, 52, 52, 52, 52,
292
+ 52, 52, 52, 52, 52, 52, 52, 52,
293
+ 52, 52, 52, 52, 52, 52, 52, 52,
294
+ 52, 52, 1, 54, 54, 54, 54, 54,
295
+ 54, 54, 54, 54, 1, 54, 54, 55,
296
+ 54, 54, 54, 54, 54, 54, 54, 54,
297
+ 54, 54, 54, 54, 54, 54, 54, 54,
298
+ 54, 54, 54, 54, 54, 54, 54, 54,
299
+ 54, 54, 56, 57, 54, 54, 54, 54,
300
+ 54, 54, 54, 54, 54, 54, 54, 54,
301
+ 54, 54, 54, 54, 54, 54, 54, 54,
302
+ 54, 54, 54, 54, 54, 54, 54, 54,
303
+ 54, 54, 54, 54, 54, 54, 54, 54,
304
+ 54, 54, 54, 54, 54, 54, 54, 54,
305
+ 54, 54, 54, 54, 54, 54, 58, 54,
306
+ 54, 54, 54, 54, 54, 54, 54, 54,
307
+ 54, 54, 54, 54, 54, 54, 54, 54,
308
+ 54, 54, 54, 54, 54, 54, 54, 54,
309
+ 54, 54, 54, 54, 54, 54, 54, 54,
310
+ 54, 54, 1, 1, 1, 1, 1, 1,
311
+ 1, 1, 1, 1, 1, 1, 1, 1,
312
+ 1, 1, 1, 1, 1, 1, 1, 1,
313
+ 1, 1, 1, 1, 1, 1, 1, 1,
314
+ 1, 1, 1, 1, 1, 1, 1, 1,
315
+ 1, 1, 1, 1, 1, 1, 1, 1,
316
+ 1, 1, 1, 1, 1, 1, 1, 1,
317
+ 1, 1, 1, 1, 1, 1, 1, 1,
318
+ 1, 1, 1, 1, 59, 59, 59, 59,
319
+ 59, 59, 59, 59, 59, 59, 59, 59,
320
+ 59, 59, 59, 59, 59, 59, 59, 59,
321
+ 59, 59, 59, 59, 59, 59, 59, 59,
322
+ 59, 59, 60, 61, 61, 61, 61, 61,
323
+ 61, 61, 61, 61, 61, 61, 61, 62,
324
+ 61, 61, 63, 64, 64, 64, 65, 1,
325
+ 66, 66, 66, 66, 66, 66, 66, 66,
326
+ 66, 1, 66, 66, 67, 66, 66, 66,
327
+ 66, 66, 66, 66, 66, 66, 66, 66,
328
+ 66, 66, 66, 66, 66, 66, 66, 66,
329
+ 66, 66, 66, 66, 66, 66, 66, 68,
330
+ 69, 66, 66, 66, 66, 66, 66, 66,
331
+ 66, 66, 66, 66, 66, 66, 66, 66,
332
+ 66, 66, 66, 66, 66, 66, 66, 66,
333
+ 66, 66, 66, 66, 66, 66, 66, 66,
334
+ 66, 66, 66, 66, 66, 66, 66, 66,
335
+ 66, 66, 66, 66, 66, 66, 66, 66,
336
+ 66, 66, 66, 70, 66, 66, 66, 66,
337
+ 66, 66, 66, 66, 66, 66, 66, 66,
338
+ 66, 66, 66, 66, 66, 66, 66, 66,
339
+ 66, 66, 66, 66, 66, 66, 66, 66,
340
+ 66, 66, 66, 66, 66, 66, 66, 1,
341
+ 1, 1, 1, 1, 1, 1, 1, 1,
342
+ 1, 1, 1, 1, 1, 1, 1, 1,
343
+ 1, 1, 1, 1, 1, 1, 1, 1,
344
+ 1, 1, 1, 1, 1, 1, 1, 1,
345
+ 1, 1, 1, 1, 1, 1, 1, 1,
346
+ 1, 1, 1, 1, 1, 1, 1, 1,
347
+ 1, 1, 1, 1, 1, 1, 1, 1,
348
+ 1, 1, 1, 1, 1, 1, 1, 1,
349
+ 1, 71, 71, 71, 71, 71, 71, 71,
350
+ 71, 71, 71, 71, 71, 71, 71, 71,
351
+ 71, 71, 71, 71, 71, 71, 71, 71,
352
+ 71, 71, 71, 71, 71, 71, 71, 72,
353
+ 73, 73, 73, 73, 73, 73, 73, 73,
354
+ 73, 73, 73, 73, 74, 73, 73, 75,
355
+ 76, 76, 76, 77, 1, 78, 1, 66,
356
+ 1, 1, 1, 1, 1, 1, 1, 1,
357
+ 1, 1, 1, 1, 1, 1, 1, 1,
358
+ 1, 1, 1, 1, 1, 1, 66, 1,
359
+ 66, 66, 66, 66, 66, 66, 66, 66,
360
+ 66, 66, 66, 66, 66, 66, 66, 66,
361
+ 66, 66, 66, 66, 66, 66, 66, 66,
362
+ 66, 66, 66, 66, 66, 66, 66, 66,
363
+ 66, 66, 66, 66, 66, 66, 66, 66,
364
+ 66, 66, 66, 66, 66, 66, 66, 66,
365
+ 66, 66, 66, 66, 66, 66, 66, 66,
366
+ 66, 66, 66, 66, 66, 66, 66, 66,
367
+ 66, 66, 66, 66, 66, 66, 66, 66,
368
+ 66, 66, 66, 66, 66, 66, 66, 66,
369
+ 66, 66, 66, 66, 66, 66, 66, 66,
370
+ 66, 66, 66, 66, 66, 66, 66, 66,
371
+ 66, 66, 66, 66, 66, 66, 66, 66,
372
+ 66, 66, 66, 66, 66, 66, 66, 66,
373
+ 66, 66, 66, 66, 66, 66, 66, 66,
374
+ 66, 66, 66, 66, 66, 66, 66, 66,
375
+ 1, 1, 1, 1, 1, 1, 1, 1,
376
+ 1, 1, 1, 1, 1, 1, 1, 1,
377
+ 1, 1, 1, 1, 1, 1, 1, 1,
378
+ 1, 1, 1, 1, 1, 1, 1, 1,
379
+ 1, 1, 1, 1, 1, 1, 1, 1,
380
+ 1, 1, 1, 1, 1, 1, 1, 1,
381
+ 1, 1, 1, 1, 1, 1, 1, 1,
382
+ 1, 1, 1, 1, 1, 1, 1, 1,
383
+ 1, 1, 71, 71, 71, 71, 71, 71,
384
+ 71, 71, 71, 71, 71, 71, 71, 71,
385
+ 71, 71, 71, 71, 71, 71, 71, 71,
386
+ 71, 71, 71, 71, 71, 71, 71, 71,
387
+ 72, 73, 73, 73, 73, 73, 73, 73,
388
+ 73, 73, 73, 73, 73, 74, 73, 73,
389
+ 75, 76, 76, 76, 77, 1, 66, 66,
390
+ 66, 66, 66, 66, 66, 66, 66, 66,
391
+ 66, 66, 66, 66, 66, 66, 66, 66,
392
+ 66, 66, 66, 66, 66, 66, 66, 66,
393
+ 66, 66, 66, 66, 66, 66, 66, 66,
394
+ 66, 66, 66, 66, 66, 66, 66, 66,
395
+ 66, 66, 66, 66, 66, 66, 66, 66,
396
+ 66, 66, 66, 66, 66, 66, 66, 66,
397
+ 66, 66, 66, 66, 66, 66, 1, 71,
398
+ 71, 71, 71, 71, 71, 71, 71, 71,
399
+ 71, 71, 71, 71, 71, 71, 71, 71,
400
+ 71, 71, 71, 71, 71, 71, 71, 71,
401
+ 71, 71, 71, 71, 71, 71, 71, 1,
402
+ 71, 71, 71, 71, 71, 71, 71, 71,
403
+ 71, 71, 71, 71, 71, 71, 71, 71,
404
+ 71, 71, 71, 71, 71, 71, 71, 71,
405
+ 71, 71, 71, 71, 71, 71, 71, 71,
406
+ 71, 71, 71, 71, 71, 71, 71, 71,
407
+ 71, 71, 71, 71, 71, 71, 71, 71,
408
+ 71, 71, 71, 71, 71, 71, 71, 71,
409
+ 71, 71, 71, 71, 71, 71, 71, 71,
410
+ 1, 71, 71, 71, 71, 71, 71, 71,
411
+ 71, 71, 71, 71, 71, 71, 71, 71,
412
+ 71, 71, 71, 71, 71, 71, 71, 71,
413
+ 71, 71, 71, 71, 71, 71, 71, 71,
414
+ 71, 1, 73, 73, 73, 73, 73, 73,
415
+ 73, 73, 73, 73, 73, 73, 73, 73,
416
+ 73, 73, 73, 73, 73, 73, 73, 73,
417
+ 73, 73, 73, 73, 73, 73, 73, 73,
418
+ 73, 73, 73, 73, 73, 73, 73, 73,
419
+ 73, 73, 73, 73, 73, 73, 73, 73,
420
+ 73, 73, 1, 73, 73, 73, 73, 73,
421
+ 73, 73, 73, 73, 73, 73, 73, 73,
422
+ 73, 73, 73, 73, 73, 73, 73, 73,
423
+ 73, 73, 73, 73, 73, 73, 73, 73,
424
+ 73, 73, 73, 73, 73, 73, 73, 73,
425
+ 73, 73, 73, 73, 73, 73, 73, 73,
426
+ 73, 73, 73, 73, 73, 73, 73, 73,
427
+ 73, 73, 73, 73, 73, 73, 73, 73,
428
+ 73, 73, 73, 1, 73, 73, 73, 73,
429
+ 73, 73, 73, 73, 73, 73, 73, 73,
430
+ 73, 73, 73, 73, 1, 79, 79, 79,
431
+ 79, 79, 79, 79, 1, 1, 79, 79,
432
+ 79, 79, 79, 1, 79, 79, 79, 79,
433
+ 79, 79, 79, 79, 79, 79, 1, 80,
434
+ 1, 1, 1, 1, 1, 79, 79, 79,
435
+ 79, 79, 79, 79, 79, 79, 79, 79,
436
+ 79, 79, 79, 79, 79, 79, 79, 79,
437
+ 79, 79, 79, 79, 79, 79, 79, 1,
438
+ 1, 1, 79, 79, 79, 79, 79, 79,
439
+ 79, 79, 79, 79, 79, 79, 79, 79,
440
+ 79, 79, 79, 79, 79, 79, 79, 79,
441
+ 79, 79, 79, 79, 79, 79, 79, 79,
442
+ 79, 79, 79, 1, 81, 1, 1, 1,
443
+ 82, 1, 1, 1, 1, 1, 1, 1,
444
+ 1, 1, 1, 1, 1, 1, 1, 1,
445
+ 1, 1, 1, 81, 1, 1, 1, 1,
446
+ 1, 1, 1, 83, 1, 1, 1, 1,
447
+ 1, 1, 1, 1, 1, 1, 1, 1,
448
+ 1, 1, 1, 1, 1, 1, 84, 1,
449
+ 85, 1, 1, 1, 86, 1, 1, 1,
450
+ 1, 1, 1, 1, 1, 1, 1, 1,
451
+ 1, 1, 1, 1, 1, 1, 1, 85,
452
+ 1, 1, 1, 1, 1, 1, 1, 87,
453
+ 1, 1, 1, 1, 1, 1, 1, 1,
454
+ 1, 1, 1, 1, 1, 1, 1, 1,
455
+ 1, 1, 88, 1, 89, 1, 1, 1,
456
+ 90, 1, 1, 1, 1, 1, 1, 1,
457
+ 1, 1, 1, 1, 1, 1, 1, 1,
458
+ 1, 1, 1, 89, 91, 1, 91, 91,
459
+ 91, 91, 91, 92, 1, 91, 91, 91,
460
+ 91, 91, 1, 91, 91, 91, 91, 91,
461
+ 91, 91, 91, 91, 91, 1, 84, 1,
462
+ 91, 1, 1, 1, 91, 91, 91, 91,
463
+ 91, 91, 91, 91, 91, 91, 91, 91,
464
+ 91, 91, 91, 91, 91, 91, 91, 91,
465
+ 91, 91, 91, 91, 91, 91, 1, 1,
466
+ 1, 91, 91, 91, 91, 91, 91, 91,
467
+ 91, 91, 91, 91, 91, 91, 91, 91,
468
+ 91, 91, 91, 91, 91, 91, 91, 91,
469
+ 91, 91, 91, 91, 91, 91, 91, 91,
470
+ 91, 91, 1, 49, 1, 1, 1, 93,
471
+ 1, 1, 1, 1, 1, 1, 1, 1,
472
+ 1, 1, 1, 1, 1, 1, 1, 1,
473
+ 1, 1, 49, 1, 1, 1, 1, 1,
474
+ 1, 1, 94, 1, 1, 1, 1, 1,
475
+ 1, 1, 1, 1, 1, 1, 1, 1,
476
+ 1, 1, 1, 1, 1, 2, 1, 95,
477
+ 1, 1, 1, 96, 1, 1, 1, 1,
478
+ 1, 1, 1, 1, 1, 1, 1, 1,
479
+ 1, 1, 1, 1, 1, 1, 95, 1,
480
+ 1, 1, 1, 1, 1, 1, 97, 1,
481
+ 1, 1, 1, 1, 1, 1, 1, 1,
482
+ 1, 1, 1, 1, 1, 1, 1, 1,
483
+ 1, 50, 1, 1, 0,
484
+ ]
485
+
486
+ class << self
487
+ attr_accessor :_trans_targs
488
+ private :_trans_targs, :_trans_targs=
489
+ end
490
+ self._trans_targs = [
491
+ 40, 0, 2, 3, 5, 27, 4, 5,
492
+ 6, 7, 8, 43, 10, 24, 7, 8,
493
+ 10, 24, 9, 11, 12, 41, 16, 17,
494
+ 18, 19, 20, 21, 22, 23, 11, 12,
495
+ 41, 16, 17, 18, 19, 20, 21, 22,
496
+ 23, 13, 15, 41, 7, 8, 10, 24,
497
+ 26, 44, 2, 3, 5, 27, 29, 30,
498
+ 29, 46, 32, 33, 34, 35, 36, 37,
499
+ 38, 39, 29, 30, 29, 46, 32, 33,
500
+ 34, 35, 36, 37, 38, 39, 31, 40,
501
+ 2, 41, 14, 42, 2, 41, 14, 42,
502
+ 2, 44, 25, 43, 45, 25, 45, 44,
503
+ 25, 45,
504
+ ]
505
+
506
+ class << self
507
+ attr_accessor :_trans_actions
508
+ private :_trans_actions, :_trans_actions=
509
+ end
510
+ self._trans_actions = [
511
+ 1, 0, 0, 0, 2, 3, 0, 0,
512
+ 4, 5, 5, 5, 5, 6, 0, 0,
513
+ 0, 3, 0, 7, 7, 8, 7, 7,
514
+ 7, 7, 7, 7, 7, 7, 0, 0,
515
+ 9, 0, 0, 0, 0, 0, 0, 0,
516
+ 0, 0, 0, 0, 10, 10, 10, 11,
517
+ 0, 0, 10, 10, 12, 11, 13, 13,
518
+ 14, 15, 13, 13, 13, 13, 13, 13,
519
+ 13, 13, 0, 0, 3, 16, 0, 0,
520
+ 0, 0, 0, 0, 0, 0, 0, 0,
521
+ 17, 18, 18, 19, 18, 20, 20, 21,
522
+ 20, 18, 18, 0, 22, 0, 3, 10,
523
+ 10, 11,
524
+ ]
525
+
526
+ class << self
527
+ attr_accessor :_eof_actions
528
+ private :_eof_actions, :_eof_actions=
529
+ end
530
+ self._eof_actions = [
531
+ 0, 0, 0, 0, 0, 0, 0, 0,
532
+ 0, 0, 0, 0, 0, 0, 0, 0,
533
+ 0, 0, 0, 0, 0, 0, 0, 0,
534
+ 0, 0, 0, 0, 0, 0, 0, 0,
535
+ 0, 0, 0, 0, 0, 0, 0, 0,
536
+ 17, 18, 20, 18, 0, 10, 0,
537
+ ]
538
+
539
+ class << self
540
+ attr_accessor :start
541
+ end
542
+ self.start = 1
543
+ class << self
544
+ attr_accessor :first_final
545
+ end
546
+ self.first_final = 40
547
+ class << self
548
+ attr_accessor :error
549
+ end
550
+ self.error = 0
551
+
552
+ class << self
553
+ attr_accessor :en_comment_tail
554
+ end
555
+ self.en_comment_tail = 28
556
+ class << self
557
+ attr_accessor :en_main
558
+ end
559
+ self.en_main = 1
15
560
 
16
- content_disposition.parameters = []
561
+ def self.parse(data)
562
+ data = data.dup.force_encoding(Encoding::ASCII_8BIT) if data.respond_to?(:force_encoding)
17
563
 
564
+ content_disposition = ContentDispositionStruct.new("", [])
565
+ return content_disposition if Mail::Utilities.blank?(data)
566
+
567
+ # Parser state
18
568
  disp_type_s = param_attr_s = param_attr = qstr_s = qstr = param_val_s = nil
19
- actions.each_slice(2) do |action_id, p|
20
- action = Mail::Parsers::Ragel::ACTIONS[action_id]
21
- case action
22
-
23
- # Disposition Type
24
- when :disp_type_s then disp_type_s = p
25
- when :disp_type_e
26
- content_disposition.disposition_type = s[disp_type_s..(p-1)].downcase
27
-
28
- # Parameter Attribute
29
- when :param_attr_s then param_attr_s = p
30
- when :param_attr_e then param_attr = s[param_attr_s..(p-1)]
31
-
32
- # Quoted String.
33
- when :qstr_s then qstr_s = p
34
- when :qstr_e then qstr = s[qstr_s..(p-1)]
35
-
36
- # Parameter Value
37
- when :param_val_s then param_val_s = p
38
- when :param_val_e
39
- if param_attr.nil?
40
- raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, s, "no attribute for value")
569
+
570
+ # 5.1 Variables Used by Ragel
571
+ p = 0
572
+ eof = pe = data.length
573
+ stack = []
574
+
575
+ begin
576
+ p ||= 0
577
+ pe ||= data.length
578
+ cs = start
579
+ top = 0
580
+ end
581
+
582
+ begin
583
+ testEof = false
584
+ _slen, _trans, _keys, _inds, _acts, _nacts = nil
585
+ _goto_level = 0
586
+ _resume = 10
587
+ _eof_trans = 15
588
+ _again = 20
589
+ _test_eof = 30
590
+ _out = 40
591
+ while true
592
+ if _goto_level <= 0
593
+ if p == pe
594
+ _goto_level = _test_eof
595
+ next
596
+ end
597
+ if cs == 0
598
+ _goto_level = _out
599
+ next
600
+ end
41
601
  end
602
+ if _goto_level <= _resume
603
+ _keys = cs << 1
604
+ _inds = _index_offsets[cs]
605
+ _slen = _key_spans[cs]
606
+ _wide = data[p].ord
607
+ _trans = if (_slen > 0 &&
608
+ _trans_keys[_keys] <= _wide &&
609
+ _wide <= _trans_keys[_keys + 1])
610
+ _indicies[_inds + _wide - _trans_keys[_keys]]
611
+ else
612
+ _indicies[_inds + _slen]
613
+ end
614
+ cs = _trans_targs[_trans]
615
+ if _trans_actions[_trans] != 0
616
+ case _trans_actions[_trans]
617
+ when 1
618
+ begin
619
+ disp_type_s = p
620
+ end
621
+ when 17
622
+ begin
623
+ content_disposition.disposition_type = chars(data, disp_type_s, p - 1).downcase
624
+ end
625
+ when 2
626
+ begin
627
+ param_attr_s = p
628
+ end
629
+ when 4
630
+ begin
631
+ param_attr = chars(data, param_attr_s, p - 1)
632
+ end
633
+ when 7
634
+ begin
635
+ qstr_s = p
636
+ end
637
+ when 9
638
+ begin
639
+ qstr = chars(data, qstr_s, p - 1)
640
+ end
641
+ when 5
642
+ begin
643
+ param_val_s = p
644
+ end
645
+ when 18
646
+ begin
647
+ if param_attr.nil?
648
+ raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, data, "no attribute for value")
649
+ end
650
+
651
+ # Use quoted string value if one exists, otherwise use parameter value
652
+ value = qstr || chars(data, param_val_s, p - 1)
653
+
654
+ content_disposition.parameters << {param_attr => value}
655
+ param_attr = nil
656
+ qstr = nil
657
+ end
658
+ when 10
659
+ begin
660
+ end
661
+ when 13
662
+ begin
663
+ end
664
+ when 3
665
+ begin
666
+ begin
667
+ stack[top] = cs
668
+ top += 1
669
+ cs = 28
670
+ _goto_level = _again
671
+ next
672
+ end
673
+ end
674
+ when 16
675
+ begin
676
+ begin
677
+ top -= 1
678
+ cs = stack[top]
679
+ _goto_level = _again
680
+ next
681
+ end
682
+ end
683
+ when 8
684
+ begin
685
+ qstr_s = p
686
+ end
687
+ begin
688
+ qstr = chars(data, qstr_s, p - 1)
689
+ end
690
+ when 6
691
+ begin
692
+ param_val_s = p
693
+ end
694
+ begin
695
+ begin
696
+ stack[top] = cs
697
+ top += 1
698
+ cs = 28
699
+ _goto_level = _again
700
+ next
701
+ end
702
+ end
703
+ when 22
704
+ begin
705
+ if param_attr.nil?
706
+ raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, data, "no attribute for value")
707
+ end
708
+
709
+ # Use quoted string value if one exists, otherwise use parameter value
710
+ value = qstr || chars(data, param_val_s, p - 1)
711
+
712
+ content_disposition.parameters << {param_attr => value}
713
+ param_attr = nil
714
+ qstr = nil
715
+ end
716
+ begin
717
+ begin
718
+ stack[top] = cs
719
+ top += 1
720
+ cs = 28
721
+ _goto_level = _again
722
+ next
723
+ end
724
+ end
725
+ when 12
726
+ begin
727
+ end
728
+ begin
729
+ param_attr_s = p
730
+ end
731
+ when 20
732
+ begin
733
+ end
734
+ begin
735
+ if param_attr.nil?
736
+ raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, data, "no attribute for value")
737
+ end
738
+
739
+ # Use quoted string value if one exists, otherwise use parameter value
740
+ value = qstr || chars(data, param_val_s, p - 1)
741
+
742
+ content_disposition.parameters << {param_attr => value}
743
+ param_attr = nil
744
+ qstr = nil
745
+ end
746
+ when 11
747
+ begin
748
+ end
749
+ begin
750
+ begin
751
+ stack[top] = cs
752
+ top += 1
753
+ cs = 28
754
+ _goto_level = _again
755
+ next
756
+ end
757
+ end
758
+ when 14
759
+ begin
760
+ end
761
+ begin
762
+ begin
763
+ stack[top] = cs
764
+ top += 1
765
+ cs = 28
766
+ _goto_level = _again
767
+ next
768
+ end
769
+ end
770
+ when 15
771
+ begin
772
+ end
773
+ begin
774
+ begin
775
+ top -= 1
776
+ cs = stack[top]
777
+ _goto_level = _again
778
+ next
779
+ end
780
+ end
781
+ when 19
782
+ begin
783
+ begin
784
+ stack[top] = cs
785
+ top += 1
786
+ cs = 28
787
+ _goto_level = _again
788
+ next
789
+ end
790
+ end
791
+ begin
792
+ if param_attr.nil?
793
+ raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, data, "no attribute for value")
794
+ end
795
+
796
+ # Use quoted string value if one exists, otherwise use parameter value
797
+ value = qstr || chars(data, param_val_s, p - 1)
42
798
 
43
- # Use quoted string value if one exists, otherwise use parameter value
44
- if qstr
45
- value = qstr
46
- else
47
- value = s[param_val_s..(p-1)]
799
+ content_disposition.parameters << {param_attr => value}
800
+ param_attr = nil
801
+ qstr = nil
802
+ end
803
+ when 21
804
+ begin
805
+ end
806
+ begin
807
+ begin
808
+ stack[top] = cs
809
+ top += 1
810
+ cs = 28
811
+ _goto_level = _again
812
+ next
813
+ end
814
+ end
815
+ begin
816
+ if param_attr.nil?
817
+ raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, data, "no attribute for value")
818
+ end
819
+
820
+ # Use quoted string value if one exists, otherwise use parameter value
821
+ value = qstr || chars(data, param_val_s, p - 1)
822
+
823
+ content_disposition.parameters << {param_attr => value}
824
+ param_attr = nil
825
+ qstr = nil
826
+ end
827
+ end
828
+ end
829
+ end
830
+ if _goto_level <= _again
831
+ if cs == 0
832
+ _goto_level = _out
833
+ next
834
+ end
835
+ p += 1
836
+ if p != pe
837
+ _goto_level = _resume
838
+ next
839
+ end
48
840
  end
841
+ if _goto_level <= _test_eof
842
+ if p == eof
843
+ case _eof_actions[cs]
844
+ when 17
845
+ begin
846
+ content_disposition.disposition_type = chars(data, disp_type_s, p - 1).downcase
847
+ end
848
+ when 18
849
+ begin
850
+ if param_attr.nil?
851
+ raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, data, "no attribute for value")
852
+ end
49
853
 
50
- content_disposition.parameters << { param_attr => value }
51
- param_attr = nil
52
- qstr = nil
854
+ # Use quoted string value if one exists, otherwise use parameter value
855
+ value = qstr || chars(data, param_val_s, p - 1)
53
856
 
54
- else
55
- raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, s, "Failed to process unknown action: #{action}")
857
+ content_disposition.parameters << {param_attr => value}
858
+ param_attr = nil
859
+ qstr = nil
860
+ end
861
+ when 10
862
+ begin
863
+ end
864
+ when 20
865
+ begin
866
+ end
867
+ begin
868
+ if param_attr.nil?
869
+ raise Mail::Field::ParseError.new(Mail::ContentDispositionElement, data, "no attribute for value")
870
+ end
871
+
872
+ # Use quoted string value if one exists, otherwise use parameter value
873
+ value = qstr || chars(data, param_val_s, p - 1)
874
+
875
+ content_disposition.parameters << {param_attr => value}
876
+ param_attr = nil
877
+ qstr = nil
878
+ end
879
+ end
880
+ end
881
+ end
882
+ if _goto_level <= _out
883
+ break
884
+ end
56
885
  end
57
886
  end
58
887
 
59
- content_disposition
60
- end
888
+ if p != eof || cs < 40
889
+ raise Mail::Field::IncompleteParseError.new(Mail::ContentDispositionElement, data, p)
890
+ end
61
891
 
62
- private
63
- def cleaned(string)
64
- string =~ /(.+);\s*$/ ? $1 : string
892
+ content_disposition
65
893
  end
66
894
  end
67
895
  end