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
This commit is contained in:
nagachika 2017-08-05 01:53:44 +00:00
parent 61277d473c
commit b2c7e9741e
5 changed files with 26 additions and 4 deletions

View file

@ -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