lib/faye/websocket/client.rb in faye-websocket-0.10.4 vs lib/faye/websocket/client.rb in faye-websocket-0.10.5
- old
+ new
@@ -32,11 +32,15 @@
@proxy.on(:connect) do
uri = URI.parse(@url)
secure = SECURE_PROTOCOLS.include?(uri.scheme)
@proxy = nil
- @stream.start_tls(@origin_tls) if secure
+ if secure
+ origin_tls = {:sni_hostname => uri.host}.merge(@origin_tls)
+ @stream.start_tls(origin_tls)
+ end
+
@driver.start
end
@proxy.on(:error) do |error|
@driver.emit(:error, error)
@@ -53,10 +57,15 @@
private
def on_connect(stream)
@stream = stream
- @stream.start_tls(@socket_tls) if @secure
+
+ if @secure
+ socket_tls = {:sni_hostname => URI.parse(@url).host}.merge(@socket_tls)
+ @stream.start_tls(socket_tls)
+ end
+
worker = @proxy || @driver
worker.start
end
module Connection