mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Be sure to unlink tempfiles after a request. Fixes #690
This commit is contained in:
parent
b8c087d967
commit
310b8eba20
2 changed files with 6 additions and 1 deletions
|
@ -39,6 +39,7 @@ module Puma
|
|||
|
||||
@body = nil
|
||||
@buffer = nil
|
||||
@tempfile = nil
|
||||
|
||||
@timeout_at = nil
|
||||
|
||||
|
@ -46,7 +47,8 @@ module Puma
|
|||
@hijacked = false
|
||||
end
|
||||
|
||||
attr_reader :env, :to_io, :body, :io, :timeout_at, :ready, :hijacked
|
||||
attr_reader :env, :to_io, :body, :io, :timeout_at, :ready, :hijacked,
|
||||
:tempfile
|
||||
|
||||
def inspect
|
||||
"#<Puma::Client:0x#{object_id.to_s(16)} @ready=#{@ready.inspect}>"
|
||||
|
@ -72,6 +74,7 @@ module Puma
|
|||
@read_header = true
|
||||
@env = @proto_env.dup
|
||||
@body = nil
|
||||
@tempfile = nil
|
||||
@parsed_bytes = 0
|
||||
@ready = false
|
||||
|
||||
|
@ -129,6 +132,7 @@ module Puma
|
|||
if remain > MAX_BODY
|
||||
@body = Tempfile.new(Const::PUMA_TMP_BASE)
|
||||
@body.binmode
|
||||
@tempfile = @body
|
||||
else
|
||||
# The body[0,0] trick is to get an empty string in the same
|
||||
# encoding as body.
|
||||
|
|
|
@ -656,6 +656,7 @@ module Puma
|
|||
uncork_socket client
|
||||
|
||||
body.close
|
||||
req.tempfile.unlink if req.tempfile
|
||||
res_body.close if res_body.respond_to? :close
|
||||
|
||||
after_reply.each { |o| o.call }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue