1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/cgi/core.rb: Constant parameter is faster and economy than

string parameter.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
xibbar 2013-05-16 10:14:45 +00:00
parent 2829cbacc3
commit 75cbab7fe1

View file

@ -587,14 +587,14 @@ class CGI
def create_body(is_large) #:nodoc:
if is_large
require 'tempfile'
body = Tempfile.new('CGI', encoding: "ascii-8bit")
body = Tempfile.new('CGI', encoding: Encoding::ASCII_8BIT)
else
begin
require 'stringio'
body = StringIO.new("".force_encoding("ascii-8bit"))
body = StringIO.new("".force_encoding(Encoding::ASCII_8BIT))
rescue LoadError
require 'tempfile'
body = Tempfile.new('CGI', encoding: "ascii-8bit")
body = Tempfile.new('CGI', encoding: Encoding::ASCII_8BIT)
end
end
body.binmode if defined? body.binmode
@ -701,9 +701,9 @@ class CGI
if value
return value
elsif defined? StringIO
StringIO.new("".force_encoding("ascii-8bit"))
StringIO.new("".force_encoding(Encoding::ASCII_8BIT))
else
Tempfile.new("CGI",encoding:"ascii-8bit")
Tempfile.new("CGI",encoding: Encoding::ASCII_8BIT)
end
else
str = if value then value.dup else "" end