* 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:
parent
2829cbacc3
commit
75cbab7fe1
@ -587,14 +587,14 @@ class CGI
|
|||||||
def create_body(is_large) #:nodoc:
|
def create_body(is_large) #:nodoc:
|
||||||
if is_large
|
if is_large
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
body = Tempfile.new('CGI', encoding: "ascii-8bit")
|
body = Tempfile.new('CGI', encoding: Encoding::ASCII_8BIT)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
require 'stringio'
|
require 'stringio'
|
||||||
body = StringIO.new("".force_encoding("ascii-8bit"))
|
body = StringIO.new("".force_encoding(Encoding::ASCII_8BIT))
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
body = Tempfile.new('CGI', encoding: "ascii-8bit")
|
body = Tempfile.new('CGI', encoding: Encoding::ASCII_8BIT)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
body.binmode if defined? body.binmode
|
body.binmode if defined? body.binmode
|
||||||
@ -701,9 +701,9 @@ class CGI
|
|||||||
if value
|
if value
|
||||||
return value
|
return value
|
||||||
elsif defined? StringIO
|
elsif defined? StringIO
|
||||||
StringIO.new("".force_encoding("ascii-8bit"))
|
StringIO.new("".force_encoding(Encoding::ASCII_8BIT))
|
||||||
else
|
else
|
||||||
Tempfile.new("CGI",encoding:"ascii-8bit")
|
Tempfile.new("CGI",encoding: Encoding::ASCII_8BIT)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
str = if value then value.dup else "" end
|
str = if value then value.dup else "" end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user