mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
{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
This commit is contained in:
parent
3203ae53ff
commit
fbd5cda6aa
15 changed files with 59 additions and 59 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
#
|
||||
# cgi/session.rb - session support for cgi scripts
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# frozen_string_literal: false
|
||||
# frozen_string_literal: true
|
||||
#
|
||||
# cgi/session/pstore.rb - persistent storage of marshalled session data
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue