2 use Rack::ContentLength
3 use Rack::ContentType, "text/plain"
6 abort "body.each called after response hijack\n"
10 abort "body.close called after response hijack\n"
16 if env["rack.hijack?"]
17 io = env["rack.hijack"].call
18 if io.respond_to?(:read_nonblock) &&
19 env["rack.hijack_io"].respond_to?(:read_nonblock)
21 # exercise both, since we Rack::Lint may use different objects
22 env["rack.hijack_io"].write("HTTP/1.0 200 OK\r\n\r\n")
23 io.write("request.hijacked")
25 return [ 500, {}, DieIfUsed.new ]
28 [ 500, {}, [ "hijack BAD\n" ] ]
30 r = "response.hijacked"
33 "Content-Length" => r.bytesize.to_s,
34 "rack.hijack" => proc do |io|