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:
parent
2829cbacc3
commit
75cbab7fe1
1 changed files with 5 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue