cgi 0.1.0 → 0.1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdab469fad9274c1f62d5a4a7d4ffd445bdfb0b596b2abd66e098dffd9e48aab
4
- data.tar.gz: 696d10e4d2ecc54f882d190478cac27c5a5b1e879c14eacc0e2ce86b2e00f08a
3
+ metadata.gz: 88d87c310da6bcfa8f2da7f97ff2fad32509e4ec853d44d8077b82e6402db9e8
4
+ data.tar.gz: cbe7e4b113e1243997974719ce4c8180eec4727f54e588144bcd4df5dd31efef
5
5
  SHA512:
6
- metadata.gz: edcf932436436eeb2367704011aad3c31220491278bfd6ca06e358799d18b3548fd73cb3714ca84f2cede0aed6d4161b5072c287db98f960ada0c3c96b0247d7
7
- data.tar.gz: 96eee5f302ebed6ce10b262b394474d3e96712ae7f6ebc5699cb6c17485d0685aa598aaf9fdbce9b6f46df1360bf4ecb9277d082f1c4a858dd884b6aee5852a9
6
+ metadata.gz: 847bb3e61e6c1bb998ec2da58cee64a0ccc3ef1647cdd1a54a9bb7e73cd91555790a7d818c36fdd46abae33ddb78c1199e0890b150c4d40ccd00c68e3c577da3
7
+ data.tar.gz: d2aed253127848dfc91ab3610aed993b5f7d37591ee1a8460cf79b6e261c680c248f411ab3eaadc5e459ca9501ccdb0c4169db8860b554ad5e4431fb680d3d89
data/cgi.gemspec CHANGED
@@ -1,25 +1,27 @@
1
- lib = File.expand_path("lib", __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "cgi/version"
1
+ begin
2
+ require_relative "lib/cgi/version"
3
+ rescue LoadError # Fallback to load version file in ruby core repository
4
+ require_relative "version"
5
+ end
4
6
 
5
7
  Gem::Specification.new do |spec|
6
8
  spec.name = "cgi"
7
9
  spec.version = CGI::VERSION
8
- spec.authors = ["Hiroshi SHIBATA"]
9
- spec.email = ["hsbt@ruby-lang.org"]
10
+ spec.authors = ["Yukihiro Matsumoto"]
11
+ spec.email = ["matz@ruby-lang.org"]
10
12
 
11
13
  spec.summary = %q{Support for the Common Gateway Interface protocol.}
12
14
  spec.description = %q{Support for the Common Gateway Interface protocol.}
13
15
  spec.homepage = "https://github.com/ruby/cgi"
16
+ spec.license = "BSD-2-Clause"
14
17
 
15
18
  spec.metadata["homepage_uri"] = spec.homepage
16
19
  spec.metadata["source_code_uri"] = spec.homepage
17
20
 
18
21
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ `git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
23
  end
21
24
  spec.bindir = "exe"
22
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
26
  spec.require_paths = ["lib"]
24
- spec.license = "BSD-2-Clause"
25
27
  end
@@ -30,15 +30,14 @@ static inline void
30
30
  preserve_original_state(VALUE orig, VALUE dest)
31
31
  {
32
32
  rb_enc_associate(dest, rb_enc_get(orig));
33
-
34
- RB_OBJ_INFECT_RAW(dest, orig);
35
33
  }
36
34
 
37
35
  static VALUE
38
36
  optimized_escape_html(VALUE str)
39
37
  {
40
38
  VALUE vbuf;
41
- char *buf = ALLOCV_N(char, vbuf, RSTRING_LEN(str) * HTML_ESCAPE_MAX_LEN);
39
+ typedef char escape_buf[HTML_ESCAPE_MAX_LEN];
40
+ char *buf = *ALLOCV_N(escape_buf, vbuf, RSTRING_LEN(str));
42
41
  const char *cstr = RSTRING_PTR(str);
43
42
  const char *end = cstr + RSTRING_LEN(str);
44
43
 
data/lib/cgi/cookie.rb CHANGED
@@ -40,6 +40,10 @@ 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
+
43
47
  # Create a new CGI::Cookie object.
44
48
  #
45
49
  # :call-seq:
@@ -57,7 +61,7 @@ class CGI
57
61
  #
58
62
  # name:: the name of the cookie. Required.
59
63
  # value:: the cookie's value or list of values.
60
- # path:: the path for which this cookie applies. Defaults to the
64
+ # path:: the path for which this cookie applies. Defaults to
61
65
  # the value of the +SCRIPT_NAME+ environment variable.
62
66
  # domain:: the domain for which this cookie applies.
63
67
  # expires:: the time at which this cookie expires, as a +Time+ object.
@@ -72,9 +76,8 @@ class CGI
72
76
  @domain = nil
73
77
  @expires = nil
74
78
  if name.kind_of?(String)
75
- @name = name
76
- %r|^(.*/)|.match(ENV["SCRIPT_NAME"])
77
- @path = ($1 or "")
79
+ self.name = name
80
+ self.path = (%r|\A(.*/)| =~ ENV["SCRIPT_NAME"] ? $1 : "")
78
81
  @secure = false
79
82
  @httponly = false
80
83
  return super(value)
@@ -85,16 +88,11 @@ class CGI
85
88
  raise ArgumentError, "`name' required"
86
89
  end
87
90
 
88
- @name = options["name"]
91
+ self.name = options["name"]
89
92
  value = Array(options["value"])
90
93
  # simple support for IE
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"]
94
+ self.path = options["path"] || (%r|\A(.*/)| =~ ENV["SCRIPT_NAME"] ? $1 : "")
95
+ self.domain = options["domain"]
98
96
  @expires = options["expires"]
99
97
  @secure = options["secure"] == true
100
98
  @httponly = options["httponly"] == true
@@ -103,11 +101,35 @@ class CGI
103
101
  end
104
102
 
105
103
  # Name of this cookie, as a +String+
106
- attr_accessor :name
104
+ attr_reader :name
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
+
107
113
  # Path for which this cookie applies, as a +String+
108
- attr_accessor :path
114
+ attr_reader :path
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
+
109
123
  # Domain for which this cookie applies, as a +String+
110
- attr_accessor :domain
124
+ attr_reader :domain
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
+
111
133
  # Time at which this cookie expires, as a +Time+
112
134
  attr_accessor :expires
113
135
  # True if this cookie is secure; false otherwise
@@ -146,7 +168,7 @@ class CGI
146
168
  buf = "#{@name}=#{val}".dup
147
169
  buf << "; domain=#{@domain}" if @domain
148
170
  buf << "; path=#{@path}" if @path
149
- buf << "; expires=#{CGI::rfc1123_date(@expires)}" if @expires
171
+ buf << "; expires=#{CGI.rfc1123_date(@expires)}" if @expires
150
172
  buf << "; secure" if @secure
151
173
  buf << "; HttpOnly" if @httponly
152
174
  buf
@@ -165,7 +187,6 @@ class CGI
165
187
  raw_cookie.split(/;\s?/).each do |pairs|
166
188
  name, values = pairs.split('=',2)
167
189
  next unless name and values
168
- name = CGI.unescape(name)
169
190
  values ||= ""
170
191
  values = values.split('&').collect{|v| CGI.unescape(v,@@accept_charset) }
171
192
  if cookies.has_key?(name)
data/lib/cgi/core.rb CHANGED
@@ -188,17 +188,28 @@ 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
+
191
202
  def _header_for_string(content_type) #:nodoc:
192
203
  buf = ''.dup
193
204
  if nph?()
194
- buf << "#{$CGI_ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'} 200 OK#{EOL}"
205
+ buf << "#{_no_crlf_check($CGI_ENV['SERVER_PROTOCOL']) || 'HTTP/1.0'} 200 OK#{EOL}"
195
206
  buf << "Date: #{CGI.rfc1123_date(Time.now)}#{EOL}"
196
- buf << "Server: #{$CGI_ENV['SERVER_SOFTWARE']}#{EOL}"
207
+ buf << "Server: #{_no_crlf_check($CGI_ENV['SERVER_SOFTWARE'])}#{EOL}"
197
208
  buf << "Connection: close#{EOL}"
198
209
  end
199
- buf << "Content-Type: #{content_type}#{EOL}"
210
+ buf << "Content-Type: #{_no_crlf_check(content_type)}#{EOL}"
200
211
  if @output_cookies
201
- @output_cookies.each {|cookie| buf << "Set-Cookie: #{cookie}#{EOL}" }
212
+ @output_cookies.each {|cookie| buf << "Set-Cookie: #{_no_crlf_check(cookie)}#{EOL}" }
202
213
  end
203
214
  return buf
204
215
  end # _header_for_string
@@ -213,9 +224,9 @@ class CGI
213
224
  ## NPH
214
225
  options.delete('nph') if defined?(MOD_RUBY)
215
226
  if options.delete('nph') || nph?()
216
- protocol = $CGI_ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'
227
+ protocol = _no_crlf_check($CGI_ENV['SERVER_PROTOCOL']) || 'HTTP/1.0'
217
228
  status = options.delete('status')
218
- status = HTTP_STATUS[status] || status || '200 OK'
229
+ status = HTTP_STATUS[status] || _no_crlf_check(status) || '200 OK'
219
230
  buf << "#{protocol} #{status}#{EOL}"
220
231
  buf << "Date: #{CGI.rfc1123_date(Time.now)}#{EOL}"
221
232
  options['server'] ||= $CGI_ENV['SERVER_SOFTWARE'] || ''
@@ -223,45 +234,45 @@ class CGI
223
234
  end
224
235
  ## common headers
225
236
  status = options.delete('status')
226
- buf << "Status: #{HTTP_STATUS[status] || status}#{EOL}" if status
237
+ buf << "Status: #{HTTP_STATUS[status] || _no_crlf_check(status)}#{EOL}" if status
227
238
  server = options.delete('server')
228
- buf << "Server: #{server}#{EOL}" if server
239
+ buf << "Server: #{_no_crlf_check(server)}#{EOL}" if server
229
240
  connection = options.delete('connection')
230
- buf << "Connection: #{connection}#{EOL}" if connection
241
+ buf << "Connection: #{_no_crlf_check(connection)}#{EOL}" if connection
231
242
  type = options.delete('type')
232
- buf << "Content-Type: #{type}#{EOL}" #if type
243
+ buf << "Content-Type: #{_no_crlf_check(type)}#{EOL}" #if type
233
244
  length = options.delete('length')
234
- buf << "Content-Length: #{length}#{EOL}" if length
245
+ buf << "Content-Length: #{_no_crlf_check(length)}#{EOL}" if length
235
246
  language = options.delete('language')
236
- buf << "Content-Language: #{language}#{EOL}" if language
247
+ buf << "Content-Language: #{_no_crlf_check(language)}#{EOL}" if language
237
248
  expires = options.delete('expires')
238
249
  buf << "Expires: #{CGI.rfc1123_date(expires)}#{EOL}" if expires
239
250
  ## cookie
240
251
  if cookie = options.delete('cookie')
241
252
  case cookie
242
253
  when String, Cookie
243
- buf << "Set-Cookie: #{cookie}#{EOL}"
254
+ buf << "Set-Cookie: #{_no_crlf_check(cookie)}#{EOL}"
244
255
  when Array
245
256
  arr = cookie
246
- arr.each {|c| buf << "Set-Cookie: #{c}#{EOL}" }
257
+ arr.each {|c| buf << "Set-Cookie: #{_no_crlf_check(c)}#{EOL}" }
247
258
  when Hash
248
259
  hash = cookie
249
- hash.each_value {|c| buf << "Set-Cookie: #{c}#{EOL}" }
260
+ hash.each_value {|c| buf << "Set-Cookie: #{_no_crlf_check(c)}#{EOL}" }
250
261
  end
251
262
  end
252
263
  if @output_cookies
253
- @output_cookies.each {|c| buf << "Set-Cookie: #{c}#{EOL}" }
264
+ @output_cookies.each {|c| buf << "Set-Cookie: #{_no_crlf_check(c)}#{EOL}" }
254
265
  end
255
266
  ## other headers
256
267
  options.each do |key, value|
257
- buf << "#{key}: #{value}#{EOL}"
268
+ buf << "#{_no_crlf_check(key)}: #{_no_crlf_check(value)}#{EOL}"
258
269
  end
259
270
  return buf
260
271
  end # _header_for_hash
261
272
  private :_header_for_hash
262
273
 
263
274
  def nph? #:nodoc:
264
- return /IIS\/(\d+)/.match($CGI_ENV['SERVER_SOFTWARE']) && $1.to_i < 5
275
+ return /IIS\/(\d+)/ =~ $CGI_ENV['SERVER_SOFTWARE'] && $1.to_i < 5
265
276
  end
266
277
 
267
278
  def _header_for_modruby(buf) #:nodoc:
@@ -375,14 +386,14 @@ class CGI
375
386
 
376
387
  # Parse an HTTP query string into a hash of key=>value pairs.
377
388
  #
378
- # params = CGI::parse("query_string")
389
+ # params = CGI.parse("query_string")
379
390
  # # {"name1" => ["value1", "value2", ...],
380
391
  # # "name2" => ["value1", "value2", ...], ... }
381
392
  #
382
- def CGI::parse(query)
393
+ def self.parse(query)
383
394
  params = {}
384
395
  query.split(/[&;]/).each do |pairs|
385
- key, value = pairs.split('=',2).collect{|v| CGI::unescape(v) }
396
+ key, value = pairs.split('=',2).collect{|v| CGI.unescape(v) }
386
397
 
387
398
  next unless key
388
399
 
@@ -544,11 +555,11 @@ class CGI
544
555
  /Content-Disposition:.* filename=(?:"(.*?)"|([^;\r\n]*))/i.match(head)
545
556
  filename = $1 || $2 || ''.dup
546
557
  filename = CGI.unescape(filename) if unescape_filename?()
547
- body.instance_variable_set(:@original_filename, filename.taint)
558
+ body.instance_variable_set(:@original_filename, filename)
548
559
  ## content type
549
560
  /Content-Type: (.*)/i.match(head)
550
561
  (content_type = $1 || ''.dup).chomp!
551
- body.instance_variable_set(:@content_type, content_type.taint)
562
+ body.instance_variable_set(:@content_type, content_type)
552
563
  ## query parameter name
553
564
  /Content-Disposition:.* name=(?:"(.*?)"|([^;\r\n]*))/i.match(head)
554
565
  name = $1 || $2 || ''
@@ -607,6 +618,7 @@ class CGI
607
618
  end
608
619
  def unescape_filename? #:nodoc:
609
620
  user_agent = $CGI_ENV['HTTP_USER_AGENT']
621
+ return false unless user_agent
610
622
  return /Mac/i.match(user_agent) && /Mozilla/i.match(user_agent) && !/MSIE/i.match(user_agent)
611
623
  end
612
624
 
@@ -648,7 +660,7 @@ class CGI
648
660
  # Reads query parameters in the @params field, and cookies into @cookies.
649
661
  def initialize_query()
650
662
  if ("POST" == env_table['REQUEST_METHOD']) and
651
- %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|.match(env_table['CONTENT_TYPE'])
663
+ %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?| =~ env_table['CONTENT_TYPE']
652
664
  current_max_multipart_length = @max_multipart_length.respond_to?(:call) ? @max_multipart_length.call : @max_multipart_length
653
665
  raise StandardError.new("too large multipart data.") if env_table['CONTENT_LENGTH'].to_i > current_max_multipart_length
654
666
  boundary = $1.dup
@@ -656,7 +668,7 @@ class CGI
656
668
  @params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
657
669
  else
658
670
  @multipart = false
659
- @params = CGI::parse(
671
+ @params = CGI.parse(
660
672
  case env_table['REQUEST_METHOD']
661
673
  when "GET", "HEAD"
662
674
  if defined?(MOD_RUBY)
@@ -686,7 +698,7 @@ class CGI
686
698
  end
687
699
  end
688
700
 
689
- @cookies = CGI::Cookie::parse((env_table['HTTP_COOKIE'] or env_table['COOKIE']))
701
+ @cookies = CGI::Cookie.parse((env_table['HTTP_COOKIE'] or env_table['COOKIE']))
690
702
  end
691
703
  private :initialize_query
692
704
 
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::escapeHTML(name.to_s)
33
+ s << CGI.escapeHTML(name.to_s)
34
34
  if value != true
35
35
  s << '="'
36
- s << CGI::escapeHTML(value.to_s)
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::pretty(buf, pretty)
426
+ CGI.pretty(buf, pretty)
427
427
  else
428
428
  buf
429
429
  end
@@ -50,7 +50,6 @@ class CGI
50
50
  require 'digest/md5'
51
51
  md5 = Digest::MD5.hexdigest(id)[0,16]
52
52
  path = dir+"/"+prefix+md5
53
- path.untaint
54
53
  if File::exist?(path)
55
54
  @hash = nil
56
55
  else
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::unescape(k)] = Marshal.restore(CGI::unescape(v))
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::escape(k), CGI::escape(String(Marshal.dump(v)))
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::escape("'Stop!' said Fred")
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::unescape("%27Stop%21%27+said+Fred")
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::escapeHTML('Usage: foo "bar" <baz>')
39
+ # CGI.escapeHTML('Usage: foo "bar" <baz>')
40
40
  # # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
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::unescapeHTML("Usage: foo &quot;bar&quot; &lt;baz&gt;")
63
+ # CGI.unescapeHTML("Usage: foo &quot;bar&quot; &lt;baz&gt;")
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::escapeHTML(str)
121
+ # Synonym for CGI.escapeHTML(str)
122
122
  alias escape_html escapeHTML
123
123
 
124
- # Synonym for CGI::unescapeHTML(str)
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::escapeElement('<BR><A HREF="url"></A>', "A", "IMG")
135
+ # print CGI.escapeElement('<BR><A HREF="url"></A>', "A", "IMG")
136
136
  # # "<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt"
137
137
  #
138
- # print CGI::escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
138
+ # print CGI.escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
139
139
  # # "<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt"
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::escapeHTML($&)
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::escapeElement()
151
+ # Undo escaping such as that done by CGI.escapeElement()
152
152
  #
153
- # print CGI::unescapeElement(
154
- # CGI::escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
153
+ # print CGI.unescapeElement(
154
+ # CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
155
155
  # # "&lt;BR&gt;<A HREF="url"></A>"
156
156
  #
157
- # print CGI::unescapeElement(
158
- # CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
157
+ # print CGI.unescapeElement(
158
+ # CGI.escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
159
159
  # # "&lt;BR&gt;<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::escapeElement(str)
171
+ # Synonym for CGI.escapeElement(str)
172
172
  alias escape_element escapeElement
173
173
 
174
- # Synonym for CGI::unescapeElement(str)
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::rfc1123_date(Time.now)
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::pretty("<HTML><BODY></BODY></HTML>")
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::pretty("<HTML><BODY></BODY></HTML>", "\t")
205
+ # print CGI.pretty("<HTML><BODY></BODY></HTML>", "\t")
206
206
  # # <HTML>
207
207
  # # <BODY>
208
208
  # # </BODY>
data/lib/cgi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class CGI
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.0.2"
3
3
  end
data/lib/cgi.rb CHANGED
@@ -253,7 +253,7 @@
253
253
  # end
254
254
  # end +
255
255
  # cgi.pre do
256
- # CGI::escapeHTML(
256
+ # CGI.escapeHTML(
257
257
  # "params: #{cgi.params.inspect}\n" +
258
258
  # "cookies: #{cgi.cookies.inspect}\n" +
259
259
  # ENV.collect do |key, value|
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.0
4
+ version: 0.1.0.2
5
5
  platform: ruby
6
6
  authors:
7
- - Hiroshi SHIBATA
8
- autorequire:
7
+ - Yukihiro Matsumoto
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-06 00:00:00.000000000 Z
11
+ date: 2022-11-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Support for the Common Gateway Interface protocol.
14
14
  email:
15
- - hsbt@ruby-lang.org
15
+ - matz@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.0.3
62
- signing_key:
61
+ rubygems_version: 3.4.0.dev
62
+ signing_key:
63
63
  specification_version: 4
64
64
  summary: Support for the Common Gateway Interface protocol.
65
65
  test_files: []