Skip to content

Commit

Permalink
Set env['rack.hijack'] to client.method(:full_hijack)
Browse files Browse the repository at this point in the history
So we don't pass the client object
  • Loading branch information
MSP-Greg committed Feb 4, 2023
1 parent 87c052f commit 647e406
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/puma/client.rb
Expand Up @@ -122,9 +122,9 @@ def inspect
"#<Puma::Client:0x#{object_id.to_s(16)} @ready=#{@ready.inspect}>"
end

# For the hijack protocol (allows us to just put the Client object
# into the env)
def call
# For the full hijack protocol, `env['rack.hijack']` is set to
# `client.method :full_hijack`
def full_hijack
@hijacked = true
env[HIJACK_IO] ||= @io
end
Expand Down
3 changes: 1 addition & 2 deletions lib/puma/request.rb
Expand Up @@ -53,7 +53,6 @@ def handle_request(client, requests)
socket = client.io # io may be a MiniSSL::Socket
app_body = nil


return false if closed_socket?(socket)

if client.http_content_length_limit_exceeded
Expand All @@ -69,7 +68,7 @@ def handle_request(client, requests)
end

env[HIJACK_P] = true
env[HIJACK] = client
env[HIJACK] = client.method :full_hijack

env[RACK_INPUT] = client.body
env[RACK_URL_SCHEME] ||= default_server_port(env) == PORT_443 ? HTTPS : HTTP
Expand Down

0 comments on commit 647e406

Please sign in to comment.