Skip to content

Commit 086e279

Browse files
committed
Allow passing cert store to client
1 parent 857bc87 commit 086e279

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/websocket-client-simple/client.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ def connect(url, options={})
2323
ctx = OpenSSL::SSL::SSLContext.new
2424
ctx.ssl_version = options[:ssl_version] if options[:ssl_version]
2525
ctx.verify_mode = options[:verify_mode] if options[:verify_mode]
26-
cert_store = OpenSSL::X509::Store.new
26+
cert_store = options[:cert_store]
27+
unless cert_store
28+
cert_store = OpenSSL::X509::Store.new
29+
end
2730
cert_store.set_default_paths
2831
ctx.cert_store = cert_store
2932
@socket = ::OpenSSL::SSL::SSLSocket.new(@socket, ctx)
33+
@socket.sync_close = true
3034
@socket.hostname = uri.host
3135
@socket.connect
3236
end

0 commit comments

Comments
 (0)