diff options
author | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-18 05:52:16 +0000 |
---|---|---|
committer | kazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-18 05:52:16 +0000 |
commit | a7379eb503c85d61f64edb66adb57f177b6b6b39 (patch) | |
tree | 2e70ab43d258030cf3179c9d12fa79c7e54e6814 /lib/cgi/core.rb | |
parent | 2e571343175bec9b34ecd729dd6fe56b7922adbb (diff) | |
download | ruby-a7379eb503c85d61f64edb66adb57f177b6b6b39.tar.gz |
{lib,test}/cgi: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cgi/core.rb')
-rw-r--r-- | lib/cgi/core.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index 1a741dcd76..fd9c41aa31 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # Methods for generating HTML, parsing CGI-related parameters, and # generating HTTP responses. @@ -182,7 +182,7 @@ class CGI alias :header :http_header def _header_for_string(content_type) #:nodoc: - buf = '' + buf = ''.dup if nph?() buf << "#{$CGI_ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'} 200 OK#{EOL}" buf << "Date: #{CGI.rfc1123_date(Time.now)}#{EOL}" @@ -198,7 +198,7 @@ class CGI private :_header_for_string def _header_for_hash(options) #:nodoc: - buf = '' + buf = ''.dup ## add charset to option['type'] options['type'] ||= 'text/html' charset = options.delete('charset') @@ -480,7 +480,7 @@ class CGI @files = {} boundary_rexp = /--#{Regexp.quote(boundary)}(#{EOL}|--)/ boundary_size = "#{EOL}--#{boundary}#{EOL}".bytesize - buf = '' + buf = ''.dup bufsize = 10 * 1024 max_count = MAX_MULTIPART_COUNT n = 0 @@ -535,12 +535,12 @@ class CGI body.rewind ## original filename /Content-Disposition:.* filename=(?:"(.*?)"|([^;\r\n]*))/i.match(head) - filename = $1 || $2 || '' + filename = $1 || $2 || ''.dup filename = CGI.unescape(filename) if unescape_filename?() body.instance_variable_set(:@original_filename, filename.taint) ## content type /Content-Type: (.*)/i.match(head) - (content_type = $1 || '').chomp! + (content_type = $1 || ''.dup).chomp! body.instance_variable_set(:@content_type, content_type.taint) ## query parameter name /Content-Disposition:.* name=(?:"(.*?)"|([^;\r\n]*))/i.match(head) @@ -589,7 +589,7 @@ class CGI else begin require 'stringio' - body = StringIO.new("".force_encoding(Encoding::ASCII_8BIT)) + body = StringIO.new("".b) rescue LoadError require 'tempfile' body = Tempfile.new('CGI', encoding: Encoding::ASCII_8BIT) @@ -700,7 +700,7 @@ class CGI if value return value elsif defined? StringIO - StringIO.new("".force_encoding(Encoding::ASCII_8BIT)) + StringIO.new("".b) else Tempfile.new("CGI",encoding: Encoding::ASCII_8BIT) end |