Class: Rack::Stream::Handlers::Http
Overview
This Handler works under EventMachine aware Rack servers like Thin
and Rainbows! It does chunked transfer encoding.
Constant Summary
collapse
- TERM =
"\r\n".freeze
- TAIL =
"0#{TERM}#{TERM}".freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize
Class Method Details
.accepts?(app) ⇒ Boolean
10
11
12
|
# File 'lib/rack/stream/handlers/http.rb', line 10
def self.accepts?(app)
true
end
|
Instance Method Details
#chunk(*chunks) ⇒ Object
14
15
16
|
# File 'lib/rack/stream/handlers/http.rb', line 14
def chunk(*chunks)
super(*chunks.map {|c| encode_chunk(c)})
end
|
#close ⇒ Object
23
24
25
|
# File 'lib/rack/stream/handlers/http.rb', line 23
def close
@body.chunk(TAIL) end
|
#open ⇒ Object
18
19
20
21
|
# File 'lib/rack/stream/handlers/http.rb', line 18
def open
@app.['Transfer-Encoding'] = 'chunked'
@app.env['async.callback'].call [@app.status, @app., @body]
end
|