class Async::HTTP::Body::Hijack
A body which is designed for hijacked connections.
def self.response(request, status, headers, &block)
def self.response(request, status, headers, &block) ::Protocol::HTTP::Response[status, headers, self.wrap(request, &block)] end
def self.wrap(request, &block)
def self.wrap(request, &block) self.new(request.body, &block) end
def call(stream)
def call(stream) return @block.call(stream) end
def empty?
def empty? if @stream @stream.empty? else false end end
def initialize(input = nil, &block)
def initialize(input = nil, &block) @input = input @block = block @task = nil @stream = nil end
def inspect
def inspect "\#<#{self.class} #{@block.inspect}>" end
def read
def read unless @task @stream = Stream.new(@input) @task = Task.current.async do @block.call(@stream) end end return @stream.output.read end