summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-05 01:53:44 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-05 01:53:44 +0000
commitb2c7e9741e0dd1a4eaab5fe4fe4c3b2f89a46bb2 (patch)
tree1ebfe86be0f94858b7791f7c855e85ee0f882ca3 /lib
parent61277d473cba50897bdce62ee0045983106999df (diff)
merge revision(s) 57501,58576: [Backport #13539]
escape.c: check argument * ext/cgi/escape/escape.c (optimized_unescape): check accept_charset encoding argument. share `@@accept_charset` * lib/cgi/{core,util}.rb: include CGI::Util not only extending, to share `@@accept_charset` class variable, so that it is always accessible. [ruby-core:80986] [Bug #13539] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@59511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/cgi/core.rb9
-rw-r--r--lib/cgi/util.rb6
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index 1a741dcd76..e5de7db5e9 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -4,6 +4,13 @@
# generating HTTP responses.
#++
class CGI
+ unless const_defined?(:Util)
+ module Util
+ @@accept_charset = "UTF-8" # :nodoc:
+ end
+ include Util
+ extend Util
+ end
$CGI_ENV = ENV # for FCGI support
@@ -734,7 +741,7 @@ class CGI
#
# CGI.accept_charset = "EUC-JP"
#
- @@accept_charset="UTF-8"
+ @@accept_charset="UTF-8" if false # needed for rdoc?
# Return the accept character set for all new CGI instances.
def self.accept_charset
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb
index 66fa54d8e9..2bf46055e2 100644
--- a/lib/cgi/util.rb
+++ b/lib/cgi/util.rb
@@ -1,5 +1,9 @@
# frozen_string_literal: false
-class CGI; module Util; end; extend Util; end
+class CGI
+ module Util; end
+ include Util
+ extend Util
+end
module CGI::Util
@@accept_charset="UTF-8" unless defined?(@@accept_charset)
# URL-encode a string.