Skip to content

Commit

Permalink
Fix implementation of rack.hijack. (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Dec 11, 2023
1 parent 3a9ff0e commit ffb9c88
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/protocol/rack/adapter/generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def unwrap_request(request, env)
end

if request.respond_to?(:hijack?) and request.hijack?
env[RACK_IS_HIJACK] = true
env[RACK_HIJACK] = proc{request.hijack!.io.dup}
end

Expand Down
3 changes: 0 additions & 3 deletions lib/protocol/rack/adapter/rack2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ class Rack2 < Generic
RACK_MULTIPROCESS = 'rack.multiprocess'
RACK_RUN_ONCE = 'rack.run_once'

RACK_IS_HIJACK = 'rack.hijack?'
RACK_HIJACK = 'rack.hijack'

def self.wrap(app)
Rewindable.new(self.new(app))
end
Expand Down
4 changes: 4 additions & 0 deletions lib/protocol/rack/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@ module CGI
RACK_URL_SCHEME = 'rack.url_scheme'
RACK_PROTOCOL = 'rack.protocol'
RACK_RESPONSE_FINISHED = 'rack.response_finished'

# Rack hijack support:
RACK_IS_HIJACK = 'rack.hijack?'
RACK_HIJACK = 'rack.hijack'
end
end

0 comments on commit ffb9c88

Please sign in to comment.