aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-11-04 12:38:43 -0600
committerPratik Naik <pratiknaik@gmail.com>2015-11-04 12:38:43 -0600
commit7c1631fa48b8862f37d1026b4f0cf1061dd6947a (patch)
treec7240f39faff2e2512ac704c9cb14382fd606302 /lib/action_cable
parentdf20d87c7b50cb7b19cc176a8f7944ee9f258446 (diff)
downloadrails-7c1631fa48b8862f37d1026b4f0cf1061dd6947a.tar.gz
rails-7c1631fa48b8862f37d1026b4f0cf1061dd6947a.tar.bz2
rails-7c1631fa48b8862f37d1026b4f0cf1061dd6947a.zip
Make sure cable closes the connection if open when responding to an invalid request
Diffstat (limited to 'lib/action_cable')
-rw-r--r--lib/action_cable/connection/base.rb3
1 files changed, 2 insertions, 1 deletions
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