cgi 0.1.0.2 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of cgi might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/cgi.gemspec +7 -9
- data/ext/cgi/escape/escape.c +2 -0
- data/lib/cgi/cookie.rb +16 -38
- data/lib/cgi/core.rb +26 -38
- data/lib/cgi/html.rb +3 -3
- data/lib/cgi/session/pstore.rb +1 -0
- data/lib/cgi/session.rb +2 -2
- data/lib/cgi/util.rb +19 -19
- data/lib/cgi/version.rb +1 -1
- data/lib/cgi.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c59b54c540f8dfd3c9cef427e4598a27bb9bd7e8153bbed89c68c2fb922103bd
|
4
|
+
data.tar.gz: f2cba0d010a587aaae58e466cb16c4d4a4361bf18aff3bc2adb38e10032ddfbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6127931c98c74e21472eb971e6fa59d97a75b944e17758ee1d31485622c845cabf076bcf53ada40b996edba1067abcd5522ff9f94f7eae75cfc020df292adf84
|
7
|
+
data.tar.gz: 76b61d86486908ab6d53193ced1e49b94de23a7df3a09ba37146c8fa3b6c68200eee2c1e206eb856d8c203ab8b4ea02b62831aeb0d7b5ca994a95a5dcef6a3b1
|
data/cgi.gemspec
CHANGED
@@ -1,27 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require_relative "version"
|
5
|
-
end
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "cgi/version"
|
6
4
|
|
7
5
|
Gem::Specification.new do |spec|
|
8
6
|
spec.name = "cgi"
|
9
7
|
spec.version = CGI::VERSION
|
10
|
-
spec.authors = ["
|
11
|
-
spec.email = ["
|
8
|
+
spec.authors = ["Hiroshi SHIBATA"]
|
9
|
+
spec.email = ["hsbt@ruby-lang.org"]
|
12
10
|
|
13
11
|
spec.summary = %q{Support for the Common Gateway Interface protocol.}
|
14
12
|
spec.description = %q{Support for the Common Gateway Interface protocol.}
|
15
13
|
spec.homepage = "https://github.com/ruby/cgi"
|
16
|
-
spec.license = "BSD-2-Clause"
|
17
14
|
|
18
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
19
16
|
spec.metadata["source_code_uri"] = spec.homepage
|
20
17
|
|
21
18
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
-
`git ls-files -z
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
20
|
end
|
24
21
|
spec.bindir = "exe"
|
25
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
23
|
spec.require_paths = ["lib"]
|
24
|
+
spec.license = "BSD-2-Clause"
|
27
25
|
end
|
data/ext/cgi/escape/escape.c
CHANGED
data/lib/cgi/cookie.rb
CHANGED
@@ -40,10 +40,6 @@ class CGI
|
|
40
40
|
class Cookie < Array
|
41
41
|
@@accept_charset="UTF-8" unless defined?(@@accept_charset)
|
42
42
|
|
43
|
-
TOKEN_RE = %r"\A[[!-~]&&[^()<>@,;:\\\"/?=\[\]{}]]+\z"
|
44
|
-
PATH_VALUE_RE = %r"\A[[ -~]&&[^;]]*\z"
|
45
|
-
DOMAIN_VALUE_RE = %r"\A(?<label>(?!-)[-A-Za-z0-9]+(?<!-))(?:\.\g<label>)*\z"
|
46
|
-
|
47
43
|
# Create a new CGI::Cookie object.
|
48
44
|
#
|
49
45
|
# :call-seq:
|
@@ -61,7 +57,7 @@ class CGI
|
|
61
57
|
#
|
62
58
|
# name:: the name of the cookie. Required.
|
63
59
|
# value:: the cookie's value or list of values.
|
64
|
-
# path:: the path for which this cookie applies. Defaults to
|
60
|
+
# path:: the path for which this cookie applies. Defaults to the
|
65
61
|
# the value of the +SCRIPT_NAME+ environment variable.
|
66
62
|
# domain:: the domain for which this cookie applies.
|
67
63
|
# expires:: the time at which this cookie expires, as a +Time+ object.
|
@@ -76,8 +72,9 @@ class CGI
|
|
76
72
|
@domain = nil
|
77
73
|
@expires = nil
|
78
74
|
if name.kind_of?(String)
|
79
|
-
|
80
|
-
|
75
|
+
@name = name
|
76
|
+
%r|^(.*/)|.match(ENV["SCRIPT_NAME"])
|
77
|
+
@path = ($1 or "")
|
81
78
|
@secure = false
|
82
79
|
@httponly = false
|
83
80
|
return super(value)
|
@@ -88,11 +85,16 @@ class CGI
|
|
88
85
|
raise ArgumentError, "`name' required"
|
89
86
|
end
|
90
87
|
|
91
|
-
|
88
|
+
@name = options["name"]
|
92
89
|
value = Array(options["value"])
|
93
90
|
# simple support for IE
|
94
|
-
|
95
|
-
|
91
|
+
if options["path"]
|
92
|
+
@path = options["path"]
|
93
|
+
else
|
94
|
+
%r|^(.*/)|.match(ENV["SCRIPT_NAME"])
|
95
|
+
@path = ($1 or "")
|
96
|
+
end
|
97
|
+
@domain = options["domain"]
|
96
98
|
@expires = options["expires"]
|
97
99
|
@secure = options["secure"] == true
|
98
100
|
@httponly = options["httponly"] == true
|
@@ -101,35 +103,11 @@ class CGI
|
|
101
103
|
end
|
102
104
|
|
103
105
|
# Name of this cookie, as a +String+
|
104
|
-
|
105
|
-
# Set name of this cookie
|
106
|
-
def name=(str)
|
107
|
-
if str and !TOKEN_RE.match?(str)
|
108
|
-
raise ArgumentError, "invalid name: #{str.dump}"
|
109
|
-
end
|
110
|
-
@name = str
|
111
|
-
end
|
112
|
-
|
106
|
+
attr_accessor :name
|
113
107
|
# Path for which this cookie applies, as a +String+
|
114
|
-
|
115
|
-
# Set path for which this cookie applies
|
116
|
-
def path=(str)
|
117
|
-
if str and !PATH_VALUE_RE.match?(str)
|
118
|
-
raise ArgumentError, "invalid path: #{str.dump}"
|
119
|
-
end
|
120
|
-
@path = str
|
121
|
-
end
|
122
|
-
|
108
|
+
attr_accessor :path
|
123
109
|
# Domain for which this cookie applies, as a +String+
|
124
|
-
|
125
|
-
# Set domain for which this cookie applies
|
126
|
-
def domain=(str)
|
127
|
-
if str and ((str = str.b).bytesize > 255 or !DOMAIN_VALUE_RE.match?(str))
|
128
|
-
raise ArgumentError, "invalid domain: #{str.dump}"
|
129
|
-
end
|
130
|
-
@domain = str
|
131
|
-
end
|
132
|
-
|
110
|
+
attr_accessor :domain
|
133
111
|
# Time at which this cookie expires, as a +Time+
|
134
112
|
attr_accessor :expires
|
135
113
|
# True if this cookie is secure; false otherwise
|
@@ -168,7 +146,7 @@ class CGI
|
|
168
146
|
buf = "#{@name}=#{val}".dup
|
169
147
|
buf << "; domain=#{@domain}" if @domain
|
170
148
|
buf << "; path=#{@path}" if @path
|
171
|
-
buf << "; expires=#{CGI
|
149
|
+
buf << "; expires=#{CGI::rfc1123_date(@expires)}" if @expires
|
172
150
|
buf << "; secure" if @secure
|
173
151
|
buf << "; HttpOnly" if @httponly
|
174
152
|
buf
|
data/lib/cgi/core.rb
CHANGED
@@ -188,28 +188,17 @@ class CGI
|
|
188
188
|
# Using #header with the HTML5 tag maker will create a <header> element.
|
189
189
|
alias :header :http_header
|
190
190
|
|
191
|
-
def _no_crlf_check(str)
|
192
|
-
if str
|
193
|
-
str = str.to_s
|
194
|
-
raise "A HTTP status or header field must not include CR and LF" if str =~ /[\r\n]/
|
195
|
-
str
|
196
|
-
else
|
197
|
-
nil
|
198
|
-
end
|
199
|
-
end
|
200
|
-
private :_no_crlf_check
|
201
|
-
|
202
191
|
def _header_for_string(content_type) #:nodoc:
|
203
192
|
buf = ''.dup
|
204
193
|
if nph?()
|
205
|
-
buf << "#{
|
194
|
+
buf << "#{$CGI_ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'} 200 OK#{EOL}"
|
206
195
|
buf << "Date: #{CGI.rfc1123_date(Time.now)}#{EOL}"
|
207
|
-
buf << "Server: #{
|
196
|
+
buf << "Server: #{$CGI_ENV['SERVER_SOFTWARE']}#{EOL}"
|
208
197
|
buf << "Connection: close#{EOL}"
|
209
198
|
end
|
210
|
-
buf << "Content-Type: #{
|
199
|
+
buf << "Content-Type: #{content_type}#{EOL}"
|
211
200
|
if @output_cookies
|
212
|
-
@output_cookies.each {|cookie| buf << "Set-Cookie: #{
|
201
|
+
@output_cookies.each {|cookie| buf << "Set-Cookie: #{cookie}#{EOL}" }
|
213
202
|
end
|
214
203
|
return buf
|
215
204
|
end # _header_for_string
|
@@ -224,9 +213,9 @@ class CGI
|
|
224
213
|
## NPH
|
225
214
|
options.delete('nph') if defined?(MOD_RUBY)
|
226
215
|
if options.delete('nph') || nph?()
|
227
|
-
protocol =
|
216
|
+
protocol = $CGI_ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'
|
228
217
|
status = options.delete('status')
|
229
|
-
status = HTTP_STATUS[status] ||
|
218
|
+
status = HTTP_STATUS[status] || status || '200 OK'
|
230
219
|
buf << "#{protocol} #{status}#{EOL}"
|
231
220
|
buf << "Date: #{CGI.rfc1123_date(Time.now)}#{EOL}"
|
232
221
|
options['server'] ||= $CGI_ENV['SERVER_SOFTWARE'] || ''
|
@@ -234,45 +223,45 @@ class CGI
|
|
234
223
|
end
|
235
224
|
## common headers
|
236
225
|
status = options.delete('status')
|
237
|
-
buf << "Status: #{HTTP_STATUS[status] ||
|
226
|
+
buf << "Status: #{HTTP_STATUS[status] || status}#{EOL}" if status
|
238
227
|
server = options.delete('server')
|
239
|
-
buf << "Server: #{
|
228
|
+
buf << "Server: #{server}#{EOL}" if server
|
240
229
|
connection = options.delete('connection')
|
241
|
-
buf << "Connection: #{
|
230
|
+
buf << "Connection: #{connection}#{EOL}" if connection
|
242
231
|
type = options.delete('type')
|
243
|
-
buf << "Content-Type: #{
|
232
|
+
buf << "Content-Type: #{type}#{EOL}" #if type
|
244
233
|
length = options.delete('length')
|
245
|
-
buf << "Content-Length: #{
|
234
|
+
buf << "Content-Length: #{length}#{EOL}" if length
|
246
235
|
language = options.delete('language')
|
247
|
-
buf << "Content-Language: #{
|
236
|
+
buf << "Content-Language: #{language}#{EOL}" if language
|
248
237
|
expires = options.delete('expires')
|
249
238
|
buf << "Expires: #{CGI.rfc1123_date(expires)}#{EOL}" if expires
|
250
239
|
## cookie
|
251
240
|
if cookie = options.delete('cookie')
|
252
241
|
case cookie
|
253
242
|
when String, Cookie
|
254
|
-
buf << "Set-Cookie: #{
|
243
|
+
buf << "Set-Cookie: #{cookie}#{EOL}"
|
255
244
|
when Array
|
256
245
|
arr = cookie
|
257
|
-
arr.each {|c| buf << "Set-Cookie: #{
|
246
|
+
arr.each {|c| buf << "Set-Cookie: #{c}#{EOL}" }
|
258
247
|
when Hash
|
259
248
|
hash = cookie
|
260
|
-
hash.each_value {|c| buf << "Set-Cookie: #{
|
249
|
+
hash.each_value {|c| buf << "Set-Cookie: #{c}#{EOL}" }
|
261
250
|
end
|
262
251
|
end
|
263
252
|
if @output_cookies
|
264
|
-
@output_cookies.each {|c| buf << "Set-Cookie: #{
|
253
|
+
@output_cookies.each {|c| buf << "Set-Cookie: #{c}#{EOL}" }
|
265
254
|
end
|
266
255
|
## other headers
|
267
256
|
options.each do |key, value|
|
268
|
-
buf << "#{
|
257
|
+
buf << "#{key}: #{value}#{EOL}"
|
269
258
|
end
|
270
259
|
return buf
|
271
260
|
end # _header_for_hash
|
272
261
|
private :_header_for_hash
|
273
262
|
|
274
263
|
def nph? #:nodoc:
|
275
|
-
return /IIS\/(\d+)
|
264
|
+
return /IIS\/(\d+)/.match($CGI_ENV['SERVER_SOFTWARE']) && $1.to_i < 5
|
276
265
|
end
|
277
266
|
|
278
267
|
def _header_for_modruby(buf) #:nodoc:
|
@@ -386,14 +375,14 @@ class CGI
|
|
386
375
|
|
387
376
|
# Parse an HTTP query string into a hash of key=>value pairs.
|
388
377
|
#
|
389
|
-
# params = CGI
|
378
|
+
# params = CGI::parse("query_string")
|
390
379
|
# # {"name1" => ["value1", "value2", ...],
|
391
380
|
# # "name2" => ["value1", "value2", ...], ... }
|
392
381
|
#
|
393
|
-
def
|
382
|
+
def CGI::parse(query)
|
394
383
|
params = {}
|
395
384
|
query.split(/[&;]/).each do |pairs|
|
396
|
-
key, value = pairs.split('=',2).collect{|v| CGI
|
385
|
+
key, value = pairs.split('=',2).collect{|v| CGI::unescape(v) }
|
397
386
|
|
398
387
|
next unless key
|
399
388
|
|
@@ -555,11 +544,11 @@ class CGI
|
|
555
544
|
/Content-Disposition:.* filename=(?:"(.*?)"|([^;\r\n]*))/i.match(head)
|
556
545
|
filename = $1 || $2 || ''.dup
|
557
546
|
filename = CGI.unescape(filename) if unescape_filename?()
|
558
|
-
body.instance_variable_set(:@original_filename, filename)
|
547
|
+
body.instance_variable_set(:@original_filename, filename.taint)
|
559
548
|
## content type
|
560
549
|
/Content-Type: (.*)/i.match(head)
|
561
550
|
(content_type = $1 || ''.dup).chomp!
|
562
|
-
body.instance_variable_set(:@content_type, content_type)
|
551
|
+
body.instance_variable_set(:@content_type, content_type.taint)
|
563
552
|
## query parameter name
|
564
553
|
/Content-Disposition:.* name=(?:"(.*?)"|([^;\r\n]*))/i.match(head)
|
565
554
|
name = $1 || $2 || ''
|
@@ -618,7 +607,6 @@ class CGI
|
|
618
607
|
end
|
619
608
|
def unescape_filename? #:nodoc:
|
620
609
|
user_agent = $CGI_ENV['HTTP_USER_AGENT']
|
621
|
-
return false unless user_agent
|
622
610
|
return /Mac/i.match(user_agent) && /Mozilla/i.match(user_agent) && !/MSIE/i.match(user_agent)
|
623
611
|
end
|
624
612
|
|
@@ -660,7 +648,7 @@ class CGI
|
|
660
648
|
# Reads query parameters in the @params field, and cookies into @cookies.
|
661
649
|
def initialize_query()
|
662
650
|
if ("POST" == env_table['REQUEST_METHOD']) and
|
663
|
-
%r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"
|
651
|
+
%r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|.match(env_table['CONTENT_TYPE'])
|
664
652
|
current_max_multipart_length = @max_multipart_length.respond_to?(:call) ? @max_multipart_length.call : @max_multipart_length
|
665
653
|
raise StandardError.new("too large multipart data.") if env_table['CONTENT_LENGTH'].to_i > current_max_multipart_length
|
666
654
|
boundary = $1.dup
|
@@ -668,7 +656,7 @@ class CGI
|
|
668
656
|
@params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
|
669
657
|
else
|
670
658
|
@multipart = false
|
671
|
-
@params = CGI
|
659
|
+
@params = CGI::parse(
|
672
660
|
case env_table['REQUEST_METHOD']
|
673
661
|
when "GET", "HEAD"
|
674
662
|
if defined?(MOD_RUBY)
|
@@ -698,7 +686,7 @@ class CGI
|
|
698
686
|
end
|
699
687
|
end
|
700
688
|
|
701
|
-
@cookies = CGI::Cookie
|
689
|
+
@cookies = CGI::Cookie::parse((env_table['HTTP_COOKIE'] or env_table['COOKIE']))
|
702
690
|
end
|
703
691
|
private :initialize_query
|
704
692
|
|
data/lib/cgi/html.rb
CHANGED
@@ -30,10 +30,10 @@ class CGI
|
|
30
30
|
attributes.each do|name, value|
|
31
31
|
next unless value
|
32
32
|
s << " "
|
33
|
-
s << CGI
|
33
|
+
s << CGI::escapeHTML(name.to_s)
|
34
34
|
if value != true
|
35
35
|
s << '="'
|
36
|
-
s << CGI
|
36
|
+
s << CGI::escapeHTML(value.to_s)
|
37
37
|
s << '"'
|
38
38
|
end
|
39
39
|
end
|
@@ -423,7 +423,7 @@ class CGI
|
|
423
423
|
buf << super(attributes)
|
424
424
|
|
425
425
|
if pretty
|
426
|
-
CGI
|
426
|
+
CGI::pretty(buf, pretty)
|
427
427
|
else
|
428
428
|
buf
|
429
429
|
end
|
data/lib/cgi/session/pstore.rb
CHANGED
data/lib/cgi/session.rb
CHANGED
@@ -403,7 +403,7 @@ class CGI
|
|
403
403
|
for line in f
|
404
404
|
line.chomp!
|
405
405
|
k, v = line.split('=',2)
|
406
|
-
@hash[CGI
|
406
|
+
@hash[CGI::unescape(k)] = Marshal.restore(CGI::unescape(v))
|
407
407
|
end
|
408
408
|
ensure
|
409
409
|
f&.close
|
@@ -421,7 +421,7 @@ class CGI
|
|
421
421
|
lockf.flock File::LOCK_EX
|
422
422
|
f = File.open(@path+".new", File::CREAT|File::TRUNC|File::WRONLY, 0600)
|
423
423
|
for k,v in @hash
|
424
|
-
f.printf "%s=%s\n", CGI
|
424
|
+
f.printf "%s=%s\n", CGI::escape(k), CGI::escape(String(Marshal.dump(v)))
|
425
425
|
end
|
426
426
|
f.close
|
427
427
|
File.rename @path+".new", @path
|
data/lib/cgi/util.rb
CHANGED
@@ -7,7 +7,7 @@ end
|
|
7
7
|
module CGI::Util
|
8
8
|
@@accept_charset="UTF-8" unless defined?(@@accept_charset)
|
9
9
|
# URL-encode a string.
|
10
|
-
# url_encoded_string = CGI
|
10
|
+
# url_encoded_string = CGI::escape("'Stop!' said Fred")
|
11
11
|
# # => "%27Stop%21%27+said+Fred"
|
12
12
|
def escape(string)
|
13
13
|
encoding = string.encoding
|
@@ -17,7 +17,7 @@ module CGI::Util
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# URL-decode a string with encoding(optional).
|
20
|
-
# string = CGI
|
20
|
+
# string = CGI::unescape("%27Stop%21%27+said+Fred")
|
21
21
|
# # => "'Stop!' said Fred"
|
22
22
|
def unescape(string,encoding=@@accept_charset)
|
23
23
|
str=string.tr('+', ' ').b.gsub(/((?:%[0-9a-fA-F]{2})+)/) do |m|
|
@@ -36,7 +36,7 @@ module CGI::Util
|
|
36
36
|
}
|
37
37
|
|
38
38
|
# Escape special characters in HTML, namely '&\"<>
|
39
|
-
# CGI
|
39
|
+
# CGI::escapeHTML('Usage: foo "bar" <baz>')
|
40
40
|
# # => "Usage: foo "bar" <baz>"
|
41
41
|
def escapeHTML(string)
|
42
42
|
enc = string.encoding
|
@@ -60,7 +60,7 @@ module CGI::Util
|
|
60
60
|
end
|
61
61
|
|
62
62
|
# Unescape a string that has been HTML-escaped
|
63
|
-
# CGI
|
63
|
+
# CGI::unescapeHTML("Usage: foo "bar" <baz>")
|
64
64
|
# # => "Usage: foo \"bar\" <baz>"
|
65
65
|
def unescapeHTML(string)
|
66
66
|
enc = string.encoding
|
@@ -118,10 +118,10 @@ module CGI::Util
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
# Synonym for CGI
|
121
|
+
# Synonym for CGI::escapeHTML(str)
|
122
122
|
alias escape_html escapeHTML
|
123
123
|
|
124
|
-
# Synonym for CGI
|
124
|
+
# Synonym for CGI::unescapeHTML(str)
|
125
125
|
alias unescape_html unescapeHTML
|
126
126
|
|
127
127
|
# Escape only the tags of certain HTML elements in +string+.
|
@@ -132,30 +132,30 @@ module CGI::Util
|
|
132
132
|
# The attribute list of the open tag will also be escaped (for
|
133
133
|
# instance, the double-quotes surrounding attribute values).
|
134
134
|
#
|
135
|
-
# print CGI
|
135
|
+
# print CGI::escapeElement('<BR><A HREF="url"></A>', "A", "IMG")
|
136
136
|
# # "<BR><A HREF="url"></A>"
|
137
137
|
#
|
138
|
-
# print CGI
|
138
|
+
# print CGI::escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
|
139
139
|
# # "<BR><A HREF="url"></A>"
|
140
140
|
def escapeElement(string, *elements)
|
141
141
|
elements = elements[0] if elements[0].kind_of?(Array)
|
142
142
|
unless elements.empty?
|
143
143
|
string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/i) do
|
144
|
-
CGI
|
144
|
+
CGI::escapeHTML($&)
|
145
145
|
end
|
146
146
|
else
|
147
147
|
string
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
-
# Undo escaping such as that done by CGI
|
151
|
+
# Undo escaping such as that done by CGI::escapeElement()
|
152
152
|
#
|
153
|
-
# print CGI
|
154
|
-
# CGI
|
153
|
+
# print CGI::unescapeElement(
|
154
|
+
# CGI::escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
|
155
155
|
# # "<BR><A HREF="url"></A>"
|
156
156
|
#
|
157
|
-
# print CGI
|
158
|
-
# CGI
|
157
|
+
# print CGI::unescapeElement(
|
158
|
+
# CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
|
159
159
|
# # "<BR><A HREF="url"></A>"
|
160
160
|
def unescapeElement(string, *elements)
|
161
161
|
elements = elements[0] if elements[0].kind_of?(Array)
|
@@ -168,10 +168,10 @@ module CGI::Util
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
# Synonym for CGI
|
171
|
+
# Synonym for CGI::escapeElement(str)
|
172
172
|
alias escape_element escapeElement
|
173
173
|
|
174
|
-
# Synonym for CGI
|
174
|
+
# Synonym for CGI::unescapeElement(str)
|
175
175
|
alias unescape_element unescapeElement
|
176
176
|
|
177
177
|
# Abbreviated day-of-week names specified by RFC 822
|
@@ -182,7 +182,7 @@ module CGI::Util
|
|
182
182
|
|
183
183
|
# Format a +Time+ object as a String using the format specified by RFC 1123.
|
184
184
|
#
|
185
|
-
# CGI
|
185
|
+
# CGI::rfc1123_date(Time.now)
|
186
186
|
# # Sat, 01 Jan 2000 00:00:00 GMT
|
187
187
|
def rfc1123_date(time)
|
188
188
|
t = time.clone.gmtime
|
@@ -196,13 +196,13 @@ module CGI::Util
|
|
196
196
|
# +string+ is the HTML string to indent. +shift+ is the indentation
|
197
197
|
# unit to use; it defaults to two spaces.
|
198
198
|
#
|
199
|
-
# print CGI
|
199
|
+
# print CGI::pretty("<HTML><BODY></BODY></HTML>")
|
200
200
|
# # <HTML>
|
201
201
|
# # <BODY>
|
202
202
|
# # </BODY>
|
203
203
|
# # </HTML>
|
204
204
|
#
|
205
|
-
# print CGI
|
205
|
+
# print CGI::pretty("<HTML><BODY></BODY></HTML>", "\t")
|
206
206
|
# # <HTML>
|
207
207
|
# # <BODY>
|
208
208
|
# # </BODY>
|
data/lib/cgi/version.rb
CHANGED
data/lib/cgi.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cgi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Hiroshi SHIBATA
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Support for the Common Gateway Interface protocol.
|
14
14
|
email:
|
15
|
-
-
|
15
|
+
- hsbt@ruby-lang.org
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
@@ -43,7 +43,7 @@ licenses:
|
|
43
43
|
metadata:
|
44
44
|
homepage_uri: https://github.com/ruby/cgi
|
45
45
|
source_code_uri: https://github.com/ruby/cgi
|
46
|
-
post_install_message:
|
46
|
+
post_install_message:
|
47
47
|
rdoc_options: []
|
48
48
|
require_paths:
|
49
49
|
- lib
|
@@ -58,8 +58,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
62
|
-
signing_key:
|
61
|
+
rubygems_version: 3.3.0.dev
|
62
|
+
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: Support for the Common Gateway Interface protocol.
|
65
65
|
test_files: []
|