diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-01-29 21:00:32 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-01-29 21:00:32 +0000 |
commit | b73299a053b305098d5d68634fa928ec71aa4eac (patch) | |
tree | 707db7cf24469ad9cea91c3ef68c95e5b48b7bfb /lib/unicorn/http_server.rb | |
parent | c43113e350aabb78c30ba64884328458db85c901 (diff) | |
parent | fedb5e50829e6dfad30ca18ea525c812eccbec70 (diff) | |
download | unicorn-b73299a053b305098d5d68634fa928ec71aa4eac.tar.gz |
* hijack: ignore normal Rack response at request-time hijack support for Rack hijack in request and response
Diffstat (limited to 'lib/unicorn/http_server.rb')
-rw-r--r-- | lib/unicorn/http_server.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index aa98aeb..cc0a705 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -550,17 +550,21 @@ class Unicorn::HttpServer # in 3 easy steps: read request, call app, write app response def process_client(client) status, headers, body = @app.call(env = @request.read(client)) + return if @request.hijacked? if 100 == status.to_i client.write(expect_100_response) env.delete(Unicorn::Const::HTTP_EXPECT) status, headers, body = @app.call(env) + return if @request.hijacked? end @request.headers? or headers = nil http_response_write(client, status, headers, body, @request.response_start_sent) - client.shutdown # in case of fork() in Rack app - client.close # flush and uncork socket immediately, no keepalive + unless client.closed? # rack.hijack may've close this for us + client.shutdown # in case of fork() in Rack app + client.close # flush and uncork socket immediately, no keepalive + end rescue => e handle_error(client, e) end |