summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cgi.rb2
-rw-r--r--lib/cgi/cookie.rb4
-rw-r--r--lib/cgi/core.rb16
-rw-r--r--lib/cgi/html.rb6
-rw-r--r--lib/cgi/session.rb2
-rw-r--r--lib/cgi/session/pstore.rb2
-rw-r--r--lib/cgi/util.rb2
7 files changed, 17 insertions, 17 deletions
diff --git a/lib/cgi.rb b/lib/cgi.rb
index 167b76cef7e..0f44a929e4d 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# cgi.rb - cgi support library
#
diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb
index 4cc050b90d1..a2155edb774 100644
--- a/lib/cgi/cookie.rb
+++ b/lib/cgi/cookie.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'cgi/util'
class CGI
# Class representing an HTTP cookie.
@@ -143,7 +143,7 @@ class CGI
# Convert the Cookie to its string representation.
def to_s
val = collect{|v| CGI.escape(v) }.join("&")
- buf = "#{@name}=#{val}"
+ buf = "#{@name}=#{val}".dup
buf << "; domain=#{@domain}" if @domain
buf << "; path=#{@path}" if @path
buf << "; expires=#{CGI::rfc1123_date(@expires)}" if @expires
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index 1a741dcd766..fd9c41aa313 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
diff --git a/lib/cgi/html.rb b/lib/cgi/html.rb
index 4b9e577b328..02d847ebd3e 100644
--- a/lib/cgi/html.rb
+++ b/lib/cgi/html.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
class CGI
# Base module for HTML-generation mixins.
#
@@ -26,7 +26,7 @@ class CGI
# - O EMPTY
def nOE_element(element, attributes = {})
attributes={attributes=>nil} if attributes.kind_of?(String)
- s = "<#{element.upcase}"
+ s = "<#{element.upcase}".dup
attributes.each do|name, value|
next unless value
s << " "
@@ -408,7 +408,7 @@ class CGI
end
pretty = attributes.delete("PRETTY")
pretty = " " if true == pretty
- buf = ""
+ buf = "".dup
if attributes.has_key?("DOCTYPE")
if attributes["DOCTYPE"]
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index b504f25f151..fbb42986a48 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# cgi/session.rb - session support for cgi scripts
#
diff --git a/lib/cgi/session/pstore.rb b/lib/cgi/session/pstore.rb
index 2dfb72bdceb..cb0370b619e 100644
--- a/lib/cgi/session/pstore.rb
+++ b/lib/cgi/session/pstore.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# cgi/session/pstore.rb - persistent storage of marshalled session data
#
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb
index 66fa54d8e90..d765fd73e69 100644
--- a/lib/cgi/util.rb
+++ b/lib/cgi/util.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
class CGI; module Util; end; extend Util; end
module CGI::Util
@@accept_charset="UTF-8" unless defined?(@@accept_charset)