Skip to content

Commit a0b663c

Browse files
committed
Raise NotImplementedError if SSL is used with hiredis or synchrony
Only the Ruby backend presently supports SSL.
1 parent 6208313 commit a0b663c

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

lib/redis/connection/hiredis.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ def self.connect(config)
1313

1414
if config[:scheme] == "unix"
1515
connection.connect_unix(config[:path], connect_timeout)
16+
elsif config[:scheme] == "rediss" || config[:ssl]
17+
raise NotImplementedError, "SSL not supported by hiredis driver"
1618
else
1719
connection.connect(config[:host], config[:port], connect_timeout)
1820
end

lib/redis/connection/synchrony.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class Synchrony
6868
def self.connect(config)
6969
if config[:scheme] == "unix"
7070
conn = EventMachine.connect_unix_domain(config[:path], RedisClient)
71+
elsif config[:scheme] == "rediss" || config[:ssl]
72+
raise NotImplementedError, "SSL not supported by synchrony driver"
7173
else
7274
conn = EventMachine.connect(config[:host], config[:port], RedisClient) do |c|
7375
c.pending_connect_timeout = [config[:connect_timeout], 0.1].max

test/ssl_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ def test_unverified_ssl_connection
2727

2828
end
2929

30+
driver(:hiredis, :synchrony) do
31+
32+
def test_ssl_not_implemented_exception
33+
assert_raise(NotImplementedError) do
34+
RedisMock.start({ :ping => proc { "+PONG" } }, ssl_server_opts("trusted")) do |port|
35+
redis = Redis.new(:port => port, :ssl => true, :ssl_params => { :ca_file => ssl_ca_file })
36+
redis.ping
37+
end
38+
end
39+
end
40+
41+
end
42+
3043
private
3144

3245
def ssl_server_opts(prefix)

0 commit comments

Comments
 (0)