Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 30 lines (25 sloc) 0.5 kb
dec966d @rkh fix Rack::Lock, use same logic for Rack::CommonLogger
rkh authored
1 module Rack
30ec24a @rkh BasicObject does not define respond_to?
rkh authored
2 class BodyProxy
dec966d @rkh fix Rack::Lock, use same logic for Rack::CommonLogger
rkh authored
3 def initialize(body, &block)
9f803f2 @janx fix BodyProxy#close
janx authored
4 @body, @block, @closed = body, block, false
dec966d @rkh fix Rack::Lock, use same logic for Rack::CommonLogger
rkh authored
5 end
6
7 def respond_to?(*args)
8 super or @body.respond_to?(*args)
9 end
10
11 def close
0c26ffe @raggi Simplify BodyProxy#close to avoid horrible loop conditions in streaming
raggi authored
12 return if @closed
13 @closed = true
b06ef82 @josevalim Rack::BodyProxy should execute block even on failures.
josevalim authored
14 begin
15 @body.close if @body.respond_to? :close
16 ensure
17 @block.call
18 end
9f803f2 @janx fix BodyProxy#close
janx authored
19 end
20
21 def closed?
22 @closed
dec966d @rkh fix Rack::Lock, use same logic for Rack::CommonLogger
rkh authored
23 end
24
25 def method_missing(*args, &block)
26 @body.__send__(*args, &block)
27 end
28 end
29 end
Something went wrong with that request. Please try again.