From 2d976622267cc94745011210f389f7cb9676c460 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 11 Dec 2023 18:11:18 +1300 Subject: [PATCH] Restore support for full hijack. --- lib/protocol/rack/adapter/generic.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/protocol/rack/adapter/generic.rb b/lib/protocol/rack/adapter/generic.rb index 6c3a18e..06fe9d5 100644 --- a/lib/protocol/rack/adapter/generic.rb +++ b/lib/protocol/rack/adapter/generic.rb @@ -73,6 +73,10 @@ def unwrap_request(request, env) env[CGI::HTTP_UPGRADE] = Array(protocol).join(",") end + if request.respond_to?(:hijack?) and request.hijack? + env[RACK_HIJACK] = proc{request.hijack!.io.dup} + end + # HTTP/2 prefers `:authority` over `host`, so we do this for backwards compatibility. env[CGI::HTTP_HOST] ||= request.authority