rubysl-uri 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/lib/rubysl/uri.rb +1 -1
- data/lib/rubysl/uri/uri.rb +88 -6
- data/lib/rubysl/uri/version.rb +1 -1
- data/lib/uri/common.rb +621 -233
- data/lib/uri/ftp.rb +81 -22
- data/lib/uri/generic.rb +665 -115
- data/lib/uri/http.rb +25 -19
- data/lib/uri/https.rb +4 -2
- data/lib/uri/ldap.rb +75 -5
- data/lib/uri/ldaps.rb +8 -0
- data/lib/uri/mailto.rb +36 -22
- data/rubysl-uri.gemspec +2 -0
- metadata +4 -4
data/lib/uri/http.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
#
|
2
1
|
# = uri/http.rb
|
3
2
|
#
|
4
3
|
# Author:: Akira Yamada <akira@ruby-lang.org>
|
5
4
|
# License:: You can redistribute it and/or modify it under the same term as Ruby.
|
6
|
-
# Revision:: $Id
|
5
|
+
# Revision:: $Id$
|
6
|
+
#
|
7
|
+
# See URI for general documentation
|
7
8
|
#
|
8
9
|
|
9
10
|
require 'uri/generic'
|
@@ -14,18 +15,20 @@ module URI
|
|
14
15
|
# The syntax of HTTP URIs is defined in RFC1738 section 3.3.
|
15
16
|
#
|
16
17
|
# Note that the Ruby URI library allows HTTP URLs containing usernames and
|
17
|
-
# passwords. This is not legal as per the RFC, but used to be
|
18
|
-
# supported in Internet Explorer 5 and 6, before the MS04-004 security
|
18
|
+
# passwords. This is not legal as per the RFC, but used to be
|
19
|
+
# supported in Internet Explorer 5 and 6, before the MS04-004 security
|
19
20
|
# update. See <URL:http://support.microsoft.com/kb/834489>.
|
20
21
|
#
|
21
22
|
class HTTP < Generic
|
23
|
+
# A Default port of 80 for URI::HTTP
|
22
24
|
DEFAULT_PORT = 80
|
23
25
|
|
26
|
+
# An Array of the available components for URI::HTTP
|
24
27
|
COMPONENT = [
|
25
|
-
:scheme,
|
26
|
-
:userinfo, :host, :port,
|
27
|
-
:path,
|
28
|
-
:query,
|
28
|
+
:scheme,
|
29
|
+
:userinfo, :host, :port,
|
30
|
+
:path,
|
31
|
+
:query,
|
29
32
|
:fragment
|
30
33
|
].freeze
|
31
34
|
|
@@ -37,21 +40,21 @@ module URI
|
|
37
40
|
# The components accepted are userinfo, host, port, path, query and
|
38
41
|
# fragment.
|
39
42
|
#
|
40
|
-
# The components should be provided either as an Array, or as a Hash
|
41
|
-
# with keys formed by preceding the component names with a colon.
|
43
|
+
# The components should be provided either as an Array, or as a Hash
|
44
|
+
# with keys formed by preceding the component names with a colon.
|
42
45
|
#
|
43
46
|
# If an Array is used, the components must be passed in the order
|
44
47
|
# [userinfo, host, port, path, query, fragment].
|
45
48
|
#
|
46
49
|
# Example:
|
47
50
|
#
|
48
|
-
# newuri = URI::HTTP.build({:host => 'www.example.com',
|
49
|
-
# :path
|
51
|
+
# newuri = URI::HTTP.build({:host => 'www.example.com',
|
52
|
+
# :path => '/foo/bar'})
|
50
53
|
#
|
51
|
-
# newuri = URI::HTTP.build([nil, "www.example.com", nil, "/path",
|
54
|
+
# newuri = URI::HTTP.build([nil, "www.example.com", nil, "/path",
|
52
55
|
# "query", 'fragment'])
|
53
56
|
#
|
54
|
-
# Currently, if passed userinfo components this method generates
|
57
|
+
# Currently, if passed userinfo components this method generates
|
55
58
|
# invalid HTTP URIs as per RFC 1738.
|
56
59
|
#
|
57
60
|
def self.build(args)
|
@@ -63,16 +66,19 @@ module URI
|
|
63
66
|
# == Description
|
64
67
|
#
|
65
68
|
# Create a new URI::HTTP object from generic URI components as per
|
66
|
-
# RFC 2396. No HTTP-specific syntax checking (as per RFC 1738) is
|
69
|
+
# RFC 2396. No HTTP-specific syntax checking (as per RFC 1738) is
|
67
70
|
# performed.
|
68
71
|
#
|
69
|
-
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
|
72
|
+
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
|
70
73
|
# +opaque+, +query+ and +fragment+, in that order.
|
71
74
|
#
|
72
75
|
# Example:
|
73
76
|
#
|
74
|
-
# uri = URI::HTTP.new(
|
75
|
-
# "query", 'fragment'
|
77
|
+
# uri = URI::HTTP.new('http', nil, "www.example.com", nil, "/path",
|
78
|
+
# "query", 'fragment')
|
79
|
+
#
|
80
|
+
#
|
81
|
+
# See also URI::Generic.new
|
76
82
|
#
|
77
83
|
def initialize(*arg)
|
78
84
|
super(*arg)
|
@@ -88,7 +94,7 @@ module URI
|
|
88
94
|
#
|
89
95
|
def request_uri
|
90
96
|
r = path_query
|
91
|
-
if r[0] != ?/
|
97
|
+
if r && r[0] != ?/
|
92
98
|
r = '/' + r
|
93
99
|
end
|
94
100
|
|
data/lib/uri/https.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
#
|
2
1
|
# = uri/https.rb
|
3
2
|
#
|
4
3
|
# Author:: Akira Yamada <akira@ruby-lang.org>
|
5
4
|
# License:: You can redistribute it and/or modify it under the same term as Ruby.
|
6
|
-
# Revision:: $Id
|
5
|
+
# Revision:: $Id$
|
6
|
+
#
|
7
|
+
# See URI for general documentation
|
7
8
|
#
|
8
9
|
|
9
10
|
require 'uri/http'
|
@@ -14,6 +15,7 @@ module URI
|
|
14
15
|
# than 'http:'. Other than that, HTTPS URIs are identical to HTTP URIs;
|
15
16
|
# see URI::HTTP.
|
16
17
|
class HTTPS < HTTP
|
18
|
+
# A Default port of 443 for URI::HTTPS
|
17
19
|
DEFAULT_PORT = 443
|
18
20
|
end
|
19
21
|
@@schemes['HTTPS'] = HTTPS
|
data/lib/uri/ldap.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
#
|
2
1
|
# = uri/ldap.rb
|
3
2
|
#
|
4
|
-
# Author::
|
3
|
+
# Author::
|
5
4
|
# Takaaki Tateishi <ttate@jaist.ac.jp>
|
6
5
|
# Akira Yamada <akira@ruby-lang.org>
|
7
|
-
# License::
|
6
|
+
# License::
|
8
7
|
# URI::LDAP is copyrighted free software by Takaaki Tateishi and Akira Yamada.
|
9
8
|
# You can redistribute it and/or modify it under the same term as Ruby.
|
10
|
-
# Revision:: $Id
|
9
|
+
# Revision:: $Id$
|
10
|
+
#
|
11
|
+
# See URI for general documentation
|
11
12
|
#
|
12
13
|
|
13
14
|
require 'uri/generic'
|
@@ -20,8 +21,10 @@ module URI
|
|
20
21
|
#
|
21
22
|
class LDAP < Generic
|
22
23
|
|
24
|
+
# A Default port of 389 for URI::LDAP
|
23
25
|
DEFAULT_PORT = 389
|
24
|
-
|
26
|
+
|
27
|
+
# An Array of the available components for URI::LDAP
|
25
28
|
COMPONENT = [
|
26
29
|
:scheme,
|
27
30
|
:host, :port,
|
@@ -32,12 +35,41 @@ module URI
|
|
32
35
|
:extensions,
|
33
36
|
].freeze
|
34
37
|
|
38
|
+
# Scopes available for the starting point.
|
39
|
+
#
|
40
|
+
# * SCOPE_BASE - the Base DN
|
41
|
+
# * SCOPE_ONE - one level under the Base DN, not including the base DN and
|
42
|
+
# not including any entries under this.
|
43
|
+
# * SCOPE_SUB - subtress, all entries at all levels
|
44
|
+
#
|
35
45
|
SCOPE = [
|
36
46
|
SCOPE_ONE = 'one',
|
37
47
|
SCOPE_SUB = 'sub',
|
38
48
|
SCOPE_BASE = 'base',
|
39
49
|
].freeze
|
40
50
|
|
51
|
+
#
|
52
|
+
# == Description
|
53
|
+
#
|
54
|
+
# Create a new URI::LDAP object from components, with syntax checking.
|
55
|
+
#
|
56
|
+
# The components accepted are host, port, dn, attributes,
|
57
|
+
# scope, filter, and extensions.
|
58
|
+
#
|
59
|
+
# The components should be provided either as an Array, or as a Hash
|
60
|
+
# with keys formed by preceding the component names with a colon.
|
61
|
+
#
|
62
|
+
# If an Array is used, the components must be passed in the order
|
63
|
+
# [host, port, dn, attributes, scope, filter, extensions].
|
64
|
+
#
|
65
|
+
# Example:
|
66
|
+
#
|
67
|
+
# newuri = URI::LDAP.build({:host => 'ldap.example.com',
|
68
|
+
# :dn> => '/dc=example'})
|
69
|
+
#
|
70
|
+
# newuri = URI::LDAP.build(["ldap.example.com", nil,
|
71
|
+
# "/dc=example;dc=com", "query", nil, nil, nil])
|
72
|
+
#
|
41
73
|
def self.build(args)
|
42
74
|
tmp = Util::make_components_hash(self, args)
|
43
75
|
|
@@ -56,6 +88,23 @@ module URI
|
|
56
88
|
return super(tmp)
|
57
89
|
end
|
58
90
|
|
91
|
+
#
|
92
|
+
# == Description
|
93
|
+
#
|
94
|
+
# Create a new URI::LDAP object from generic URI components as per
|
95
|
+
# RFC 2396. No LDAP-specific syntax checking is performed.
|
96
|
+
#
|
97
|
+
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
|
98
|
+
# +opaque+, +query+ and +fragment+, in that order.
|
99
|
+
#
|
100
|
+
# Example:
|
101
|
+
#
|
102
|
+
# uri = URI::LDAP.new("ldap", nil, "ldap.example.com", nil,
|
103
|
+
# "/dc=example;dc=com", "query", nil, nil, nil, nil)
|
104
|
+
#
|
105
|
+
#
|
106
|
+
# See also URI::Generic.new
|
107
|
+
#
|
59
108
|
def initialize(*arg)
|
60
109
|
super(*arg)
|
61
110
|
|
@@ -67,11 +116,14 @@ module URI
|
|
67
116
|
parse_query
|
68
117
|
end
|
69
118
|
|
119
|
+
# private method to cleanup +dn+ from using the +path+ component attribute
|
70
120
|
def parse_dn
|
71
121
|
@dn = @path[1..-1]
|
72
122
|
end
|
73
123
|
private :parse_dn
|
74
124
|
|
125
|
+
# private method to cleanup +attributes+, +scope+, +filter+ and +extensions+,
|
126
|
+
# from using the +query+ component attribute
|
75
127
|
def parse_query
|
76
128
|
@attributes = nil
|
77
129
|
@scope = nil
|
@@ -89,6 +141,7 @@ module URI
|
|
89
141
|
end
|
90
142
|
private :parse_query
|
91
143
|
|
144
|
+
# private method to assemble +query+ from +attributes+, +scope+, +filter+ and +extensions+.
|
92
145
|
def build_path_query
|
93
146
|
@path = '/' + @dn
|
94
147
|
|
@@ -101,10 +154,12 @@ module URI
|
|
101
154
|
end
|
102
155
|
private :build_path_query
|
103
156
|
|
157
|
+
# returns dn.
|
104
158
|
def dn
|
105
159
|
@dn
|
106
160
|
end
|
107
161
|
|
162
|
+
# private setter for dn +val+
|
108
163
|
def set_dn(val)
|
109
164
|
@dn = val
|
110
165
|
build_path_query
|
@@ -112,15 +167,18 @@ module URI
|
|
112
167
|
end
|
113
168
|
protected :set_dn
|
114
169
|
|
170
|
+
# setter for dn +val+
|
115
171
|
def dn=(val)
|
116
172
|
set_dn(val)
|
117
173
|
val
|
118
174
|
end
|
119
175
|
|
176
|
+
# returns attributes.
|
120
177
|
def attributes
|
121
178
|
@attributes
|
122
179
|
end
|
123
180
|
|
181
|
+
# private setter for attributes +val+
|
124
182
|
def set_attributes(val)
|
125
183
|
@attributes = val
|
126
184
|
build_path_query
|
@@ -128,15 +186,18 @@ module URI
|
|
128
186
|
end
|
129
187
|
protected :set_attributes
|
130
188
|
|
189
|
+
# setter for attributes +val+
|
131
190
|
def attributes=(val)
|
132
191
|
set_attributes(val)
|
133
192
|
val
|
134
193
|
end
|
135
194
|
|
195
|
+
# returns scope.
|
136
196
|
def scope
|
137
197
|
@scope
|
138
198
|
end
|
139
199
|
|
200
|
+
# private setter for scope +val+
|
140
201
|
def set_scope(val)
|
141
202
|
@scope = val
|
142
203
|
build_path_query
|
@@ -144,15 +205,18 @@ module URI
|
|
144
205
|
end
|
145
206
|
protected :set_scope
|
146
207
|
|
208
|
+
# setter for scope +val+
|
147
209
|
def scope=(val)
|
148
210
|
set_scope(val)
|
149
211
|
val
|
150
212
|
end
|
151
213
|
|
214
|
+
# returns filter.
|
152
215
|
def filter
|
153
216
|
@filter
|
154
217
|
end
|
155
218
|
|
219
|
+
# private setter for filter +val+
|
156
220
|
def set_filter(val)
|
157
221
|
@filter = val
|
158
222
|
build_path_query
|
@@ -160,15 +224,18 @@ module URI
|
|
160
224
|
end
|
161
225
|
protected :set_filter
|
162
226
|
|
227
|
+
# setter for filter +val+
|
163
228
|
def filter=(val)
|
164
229
|
set_filter(val)
|
165
230
|
val
|
166
231
|
end
|
167
232
|
|
233
|
+
# returns extensions.
|
168
234
|
def extensions
|
169
235
|
@extensions
|
170
236
|
end
|
171
237
|
|
238
|
+
# private setter for extensions +val+
|
172
239
|
def set_extensions(val)
|
173
240
|
@extensions = val
|
174
241
|
build_path_query
|
@@ -176,11 +243,14 @@ module URI
|
|
176
243
|
end
|
177
244
|
protected :set_extensions
|
178
245
|
|
246
|
+
# setter for extensions +val+
|
179
247
|
def extensions=(val)
|
180
248
|
set_extensions(val)
|
181
249
|
val
|
182
250
|
end
|
183
251
|
|
252
|
+
# Checks if URI has a path
|
253
|
+
# For URI::LDAP this will return +false+
|
184
254
|
def hierarchical?
|
185
255
|
false
|
186
256
|
end
|
data/lib/uri/ldaps.rb
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# = uri/ldap.rb
|
2
|
+
#
|
3
|
+
# License:: You can redistribute it and/or modify it under the same term as Ruby.
|
4
|
+
#
|
5
|
+
# See URI for general documentation
|
6
|
+
#
|
7
|
+
|
1
8
|
require 'uri/ldap'
|
2
9
|
|
3
10
|
module URI
|
@@ -6,6 +13,7 @@ module URI
|
|
6
13
|
# than 'ldap:'. Other than that, LDAPS URIs are identical to LDAP URIs;
|
7
14
|
# see URI::LDAP.
|
8
15
|
class LDAPS < LDAP
|
16
|
+
# A Default port of 636 for URI::LDAPS
|
9
17
|
DEFAULT_PORT = 636
|
10
18
|
end
|
11
19
|
@@schemes['LDAPS'] = LDAPS
|
data/lib/uri/mailto.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
#
|
2
1
|
# = uri/mailto.rb
|
3
2
|
#
|
4
3
|
# Author:: Akira Yamada <akira@ruby-lang.org>
|
5
4
|
# License:: You can redistribute it and/or modify it under the same term as Ruby.
|
6
|
-
# Revision:: $Id
|
5
|
+
# Revision:: $Id$
|
6
|
+
#
|
7
|
+
# See URI for general documentation
|
7
8
|
#
|
8
9
|
|
9
10
|
require 'uri/generic'
|
@@ -16,8 +17,10 @@ module URI
|
|
16
17
|
class MailTo < Generic
|
17
18
|
include REGEXP
|
18
19
|
|
20
|
+
# A Default port of nil for URI::MailTo
|
19
21
|
DEFAULT_PORT = nil
|
20
22
|
|
23
|
+
# An Array of the available components for URI::MailTo
|
21
24
|
COMPONENT = [ :scheme, :to, :headers ].freeze
|
22
25
|
|
23
26
|
# :stopdoc:
|
@@ -38,7 +41,7 @@ module URI
|
|
38
41
|
# hvalue = *urlc
|
39
42
|
# header = hname "=" hvalue
|
40
43
|
HEADER_PATTERN = "(?:[^?=&]*=[^?=&]*)".freeze
|
41
|
-
HEADER_REGEXP = Regexp.new(HEADER_PATTERN
|
44
|
+
HEADER_REGEXP = Regexp.new(HEADER_PATTERN).freeze
|
42
45
|
# headers = "?" header *( "&" header )
|
43
46
|
# to = #mailbox
|
44
47
|
# mailtoURL = "mailto:" [ to ] [ headers ]
|
@@ -55,7 +58,7 @@ module URI
|
|
55
58
|
(#{PATTERN::FRAGMENT}) (?# 3: fragment)
|
56
59
|
)?
|
57
60
|
\\z
|
58
|
-
", Regexp::EXTENDED
|
61
|
+
", Regexp::EXTENDED).freeze
|
59
62
|
# :startdoc:
|
60
63
|
|
61
64
|
#
|
@@ -68,20 +71,20 @@ module URI
|
|
68
71
|
#
|
69
72
|
# If a Hash is used, the keys are the component names preceded by colons.
|
70
73
|
#
|
71
|
-
# The headers can be supplied as a pre-encoded string, such as
|
74
|
+
# The headers can be supplied as a pre-encoded string, such as
|
72
75
|
# "subject=subscribe&cc=address", or as an Array of Arrays like
|
73
76
|
# [['subject', 'subscribe'], ['cc', 'address']]
|
74
77
|
#
|
75
78
|
# Examples:
|
76
|
-
#
|
79
|
+
#
|
77
80
|
# require 'uri'
|
78
|
-
#
|
81
|
+
#
|
79
82
|
# m1 = URI::MailTo.build(['joe@example.com', 'subject=Ruby'])
|
80
83
|
# puts m1.to_s -> mailto:joe@example.com?subject=Ruby
|
81
|
-
#
|
84
|
+
#
|
82
85
|
# m2 = URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]])
|
83
86
|
# puts m2.to_s -> mailto:john@example.com?Subject=Ruby&Cc=jack@example.com
|
84
|
-
#
|
87
|
+
#
|
85
88
|
# m3 = URI::MailTo.build({:to => 'listman@example.com', :headers => [['subject', 'subscribe']]})
|
86
89
|
# puts m3.to_s -> mailto:listman@example.com?subject=subscribe
|
87
90
|
#
|
@@ -100,7 +103,7 @@ module URI
|
|
100
103
|
if tmp[:headers].kind_of?(Array)
|
101
104
|
tmp[:opaque] << tmp[:headers].collect { |x|
|
102
105
|
if x.kind_of?(Array)
|
103
|
-
x[0] + '=' + x[1..-1].
|
106
|
+
x[0] + '=' + x[1..-1].join
|
104
107
|
else
|
105
108
|
x.to_s
|
106
109
|
end
|
@@ -135,7 +138,7 @@ module URI
|
|
135
138
|
@headers = []
|
136
139
|
|
137
140
|
if MAILTO_REGEXP =~ @opaque
|
138
|
-
|
141
|
+
if arg[-1]
|
139
142
|
self.to = $1
|
140
143
|
self.headers = $2
|
141
144
|
else
|
@@ -155,11 +158,14 @@ module URI
|
|
155
158
|
# E-mail headers set by the URL, as an Array of Arrays
|
156
159
|
attr_reader :headers
|
157
160
|
|
161
|
+
# check the to +v+ component against either
|
162
|
+
# * URI::Parser Regexp for :OPAQUE
|
163
|
+
# * MAILBOX_PATTERN
|
158
164
|
def check_to(v)
|
159
165
|
return true unless v
|
160
166
|
return true if v.size == 0
|
161
167
|
|
162
|
-
if OPAQUE !~ v || /\A#{MAILBOX_PATTERN}*\z/o !~ v
|
168
|
+
if parser.regexp[:OPAQUE] !~ v || /\A#{MAILBOX_PATTERN}*\z/o !~ v
|
163
169
|
raise InvalidComponentError,
|
164
170
|
"bad component(expected opaque component): #{v}"
|
165
171
|
end
|
@@ -168,22 +174,27 @@ module URI
|
|
168
174
|
end
|
169
175
|
private :check_to
|
170
176
|
|
177
|
+
# private setter for to +v+
|
171
178
|
def set_to(v)
|
172
179
|
@to = v
|
173
180
|
end
|
174
181
|
protected :set_to
|
175
182
|
|
183
|
+
# setter for to +v+
|
176
184
|
def to=(v)
|
177
185
|
check_to(v)
|
178
186
|
set_to(v)
|
179
187
|
v
|
180
188
|
end
|
181
189
|
|
190
|
+
# check the headers +v+ component against either
|
191
|
+
# * URI::Parser Regexp for :OPAQUE
|
192
|
+
# * HEADER_PATTERN
|
182
193
|
def check_headers(v)
|
183
194
|
return true unless v
|
184
195
|
return true if v.size == 0
|
185
196
|
|
186
|
-
if OPAQUE !~ v ||
|
197
|
+
if parser.regexp[:OPAQUE] !~ v ||
|
187
198
|
/\A(#{HEADER_PATTERN}(?:\&#{HEADER_PATTERN})*)\z/o !~ v
|
188
199
|
raise InvalidComponentError,
|
189
200
|
"bad component(expected opaque component): #{v}"
|
@@ -193,6 +204,7 @@ module URI
|
|
193
204
|
end
|
194
205
|
private :check_headers
|
195
206
|
|
207
|
+
# private setter for headers +v+
|
196
208
|
def set_headers(v)
|
197
209
|
@headers = []
|
198
210
|
if v
|
@@ -203,19 +215,21 @@ module URI
|
|
203
215
|
end
|
204
216
|
protected :set_headers
|
205
217
|
|
218
|
+
# setter for headers +v+
|
206
219
|
def headers=(v)
|
207
220
|
check_headers(v)
|
208
221
|
set_headers(v)
|
209
222
|
v
|
210
223
|
end
|
211
224
|
|
225
|
+
# Constructs String from URI
|
212
226
|
def to_s
|
213
|
-
@scheme + ':' +
|
214
|
-
if @to
|
227
|
+
@scheme + ':' +
|
228
|
+
if @to
|
215
229
|
@to
|
216
230
|
else
|
217
231
|
''
|
218
|
-
end +
|
232
|
+
end +
|
219
233
|
if @headers.size > 0
|
220
234
|
'?' + @headers.collect{|x| x.join('=')}.join('&')
|
221
235
|
else
|
@@ -227,7 +241,7 @@ module URI
|
|
227
241
|
''
|
228
242
|
end
|
229
243
|
end
|
230
|
-
|
244
|
+
|
231
245
|
# Returns the RFC822 e-mail text equivalent of the URL, as a String.
|
232
246
|
#
|
233
247
|
# Example:
|
@@ -239,18 +253,18 @@ module URI
|
|
239
253
|
# # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n"
|
240
254
|
#
|
241
255
|
def to_mailtext
|
242
|
-
to =
|
256
|
+
to = parser.unescape(@to)
|
243
257
|
head = ''
|
244
258
|
body = ''
|
245
259
|
@headers.each do |x|
|
246
260
|
case x[0]
|
247
261
|
when 'body'
|
248
|
-
body =
|
262
|
+
body = parser.unescape(x[1])
|
249
263
|
when 'to'
|
250
|
-
to << ', ' +
|
264
|
+
to << ', ' + parser.unescape(x[1])
|
251
265
|
else
|
252
|
-
head <<
|
253
|
-
|
266
|
+
head << parser.unescape(x[0]).capitalize + ': ' +
|
267
|
+
parser.unescape(x[1]) + "\n"
|
254
268
|
end
|
255
269
|
end
|
256
270
|
|