зеркало из https://github.com/github/ruby.git
* lib/cgi/core.rb: Use Tempfile#close(true) instead of Tempfile#unlink
to close file descriptors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9ee98ff798
Коммит
c968f908e1
|
@ -1,3 +1,8 @@
|
|||
Tue May 27 23:50:07 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/cgi/core.rb: Use Tempfile#close(true) instead of Tempfile#unlink
|
||||
to close file descriptors.
|
||||
|
||||
Tue May 27 23:06:46 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_number_literal_suffix): refine error message for
|
||||
|
|
|
@ -550,7 +550,7 @@ class CGI
|
|||
name = $1 || $2 || ''
|
||||
if body.original_filename.empty?
|
||||
value=body.read.dup.force_encoding(@accept_charset)
|
||||
body.unlink if defined?(Tempfile) && body.kind_of?(Tempfile)
|
||||
body.close(true) if defined?(Tempfile) && body.kind_of?(Tempfile)
|
||||
(params[name] ||= []) << value
|
||||
unless value.valid_encoding?
|
||||
if @accept_charset_error_block
|
||||
|
@ -578,7 +578,7 @@ class CGI
|
|||
if tempfiles
|
||||
tempfiles.each {|t|
|
||||
if t.path
|
||||
t.unlink
|
||||
t.close(true)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
|
|
@ -118,7 +118,7 @@ class CGIMultipartTest < Test::Unit::TestCase
|
|||
$stdin.close() if $stdin.is_a?(Tempfile)
|
||||
$stdin = STDIN
|
||||
@tempfiles.each {|t|
|
||||
t.unlink
|
||||
t.close(true)
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -179,7 +179,7 @@ class CGIMultipartTest < Test::Unit::TestCase
|
|||
cgi.params.each {|name, vals|
|
||||
vals.each {|val|
|
||||
if val.kind_of?(Tempfile) && val.path
|
||||
val.unlink
|
||||
val.close(true)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ class CGIMultipartTest < Test::Unit::TestCase
|
|||
cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
|
||||
assert_equal(cgi['foo'], 'bar')
|
||||
assert_equal(cgi['file'].read, 'b'*10134)
|
||||
cgi['file'].unlink if cgi['file'].kind_of? Tempfile
|
||||
cgi['file'].close(true) if cgi['file'].kind_of? Tempfile
|
||||
end
|
||||
|
||||
def test_cgi_multipart_without_tempfile
|
||||
|
|
Загрузка…
Ссылка в новой задаче