From 1a2a82721bf845a3f7e7a3972bc0f41befb25c41 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 14 Nov 2015 02:47:25 +0000 Subject: http_parser: workaround hijack changes in unicorn 5 unicorn lost the hijack_setup method in version 5, so we must recreate it ourselves. --- lib/rainbows/response.rb | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'lib/rainbows/response.rb') diff --git a/lib/rainbows/response.rb b/lib/rainbows/response.rb index 2e8d2d8..0b5e542 100644 --- a/lib/rainbows/response.rb +++ b/lib/rainbows/response.rb @@ -15,18 +15,8 @@ module Rainbows::Response Rainbows::HttpParser.keepalive_requests = 0 end - # Rack 1.5.0 (protocol version 1.2) adds response hijacking support - if ((Rack::VERSION[0] << 8) | Rack::VERSION[1]) >= 0x0102 - def hijack_prepare(value) - value - end - - def hijack_socket - @hp.env['rack.hijack'].call - end - else - def hijack_prepare(_) - end + def hijack_socket + @hp.env['rack.hijack'].call end # returns the original body on success @@ -45,7 +35,7 @@ module Rainbows::Response when "rack.hijack" # this was an illegal key in Rack < 1.5, so it should be # OK to silently discard it for those older versions - hijack = hijack_prepare(value) + hijack = value alive = false # No persistent connections for hijacking else if /\n/ =~ value -- cgit v1.2.3-24-ge0c7