@@ -8,9 +8,9 @@ module ActionCable
88 module Server
99 # A wrapper over ConcurrentRuby::ThreadPoolExecutor and Concurrent::TimerTask
1010 class ThreadedExecutor # :nodoc:
11- def initialize ( max_size : 10 )
11+ def initialize ( max_size : 10 , name : "server" )
1212 @executor = Concurrent ::ThreadPoolExecutor . new (
13- name : "ActionCable-streamer " ,
13+ name : "ActionCable-#{ name } " ,
1414 min_threads : 1 ,
1515 max_threads : max_size ,
1616 max_queue : 0 ,
@@ -121,7 +121,7 @@ def worker_pool
121121
122122 # Executor is used by various actions within Action Cable (e.g., pub/sub operations) to run code asynchronously.
123123 def executor
124- @executor || @mutex . synchronize { @executor ||= ThreadedExecutor . new ( max_size : config . executor_pool_size ) }
124+ @executor || @mutex . synchronize { @executor ||= ThreadedExecutor . new ( max_size : config . executor_pool_size , name : "streamer" ) }
125125 end
126126
127127 # Adapter used for all streams/broadcasting.
@@ -146,8 +146,9 @@ def new_tagged_logger(request = nil, &block)
146146 def allow_request_origin? ( env )
147147 return true if config . disable_request_forgery_protection
148148
149- proto = Rack ::Request . new ( env ) . ssl? ? "https" : "http"
150- if config . allow_same_origin_as_host && env [ "HTTP_ORIGIN" ] == "#{ proto } ://#{ env [ 'HTTP_HOST' ] } "
149+ request = ActionDispatch ::Request . new ( env )
150+ proto = request . ssl? ? "https" : "http"
151+ if config . allow_same_origin_as_host && env [ "HTTP_ORIGIN" ] == "#{ proto } ://#{ request . host_with_port } "
151152 true
152153 elsif Array ( config . allowed_request_origins ) . any? { |allowed_origin | allowed_origin === env [ "HTTP_ORIGIN" ] }
153154 true
0 commit comments