From 7c1631fa48b8862f37d1026b4f0cf1061dd6947a Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Wed, 4 Nov 2015 12:38:43 -0600 Subject: Make sure cable closes the connection if open when responding to an invalid request --- lib/action_cable/connection/base.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/action_cable') diff --git a/lib/action_cable/connection/base.rb b/lib/action_cable/connection/base.rb index a629f29643..ac45124a28 100644 --- a/lib/action_cable/connection/base.rb +++ b/lib/action_cable/connection/base.rb @@ -151,7 +151,6 @@ module ActionCable server.add_connection(self) rescue ActionCable::Connection::Authorization::UnauthorizedError respond_to_invalid_request - close end def on_message(message) @@ -186,6 +185,8 @@ module ActionCable end def respond_to_invalid_request + close if websocket.alive? + logger.info finished_request_message [ 404, { 'Content-Type' => 'text/plain' }, [ 'Page not found' ] ] end -- cgit v1.2.3