lib/cgi/core.rb in rubysl-cgi-2.0.0 vs lib/cgi/core.rb in rubysl-cgi-2.0.1
- old
+ new
@@ -13,11 +13,11 @@
LF = "\012"
# Standard internet newline sequence
EOL = CR + LF
- REVISION = '$Id$' #:nodoc:
+ REVISION = '$Id: core.rb 40787 2013-05-16 10:14:45Z xibbar $' #:nodoc:
# Whether processing will be required in binary vs text
NEEDS_BINMODE = File::BINARY != 0
# Path separators in different environments.
@@ -236,11 +236,11 @@
when Array
arr = cookie
arr.each {|c| buf << "Set-Cookie: #{c}#{EOL}" }
when Hash
hash = cookie
- hash.each {|name, c| buf << "Set-Cookie: #{c}#{EOL}" }
+ hash.each_value {|c| buf << "Set-Cookie: #{c}#{EOL}" }
end
end
if @output_cookies
@output_cookies.each {|c| buf << "Set-Cookie: #{c}#{EOL}" }
end
@@ -585,18 +585,18 @@
end # read_multipart
private :read_multipart
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
return body
end
@@ -699,13 +699,13 @@
value = params[0]
if @multipart
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
str
end
@@ -830,32 +830,26 @@
case @options[:tag_maker]
when "html3"
require 'cgi/html'
extend Html3
- element_init()
extend HtmlExtension
when "html4"
require 'cgi/html'
extend Html4
- element_init()
extend HtmlExtension
when "html4Tr"
require 'cgi/html'
extend Html4Tr
- element_init()
extend HtmlExtension
when "html4Fr"
require 'cgi/html'
extend Html4Tr
- element_init()
extend Html4Fr
- element_init()
extend HtmlExtension
when "html5"
require 'cgi/html'
extend Html5
- element_init()
extend HtmlExtension
end
end
end # class CGI