mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Better compatibility with SPEC.
If `env` is duped or otherwise not the same as the original `env` that was generated at the top of rack middleware, it is impossible for the server hijack proc to update the right `env` instance. Therefore, capturing the return value is more reliable. This is the recommendation of the rack SPEC.
This commit is contained in:
parent
90e2739d86
commit
93e185e1d4
1 changed files with 4 additions and 2 deletions
|
@ -98,8 +98,10 @@ module ActionCable
|
|||
def hijack_rack_socket
|
||||
return unless @socket_object.env["rack.hijack"]
|
||||
|
||||
@socket_object.env["rack.hijack"].call
|
||||
@rack_hijack_io = @socket_object.env["rack.hijack_io"]
|
||||
# This should return the underlying io according to the SPEC:
|
||||
@rack_hijack_io = @socket_object.env["rack.hijack"].call
|
||||
# Retain existing behaviour if required:
|
||||
@rack_hijack_io ||= @socket_object.env["rack.hijack_io"]
|
||||
|
||||
@event_loop.attach(@rack_hijack_io, self)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue