Skip to content

Commit 9341873

Browse files
author
Julien Enselme
committed
Fix establishing an SSL connection
Adapted from BureauxLocaux@18ea61f See sebleier#118
1 parent aa9a187 commit 9341873

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

redis_cache/connection.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from redis.connection import UnixDomainSocketConnection, Connection
1+
from redis.connection import UnixDomainSocketConnection, Connection, SSLConnection
22

33

44
class CacheConnectionPool(object):
@@ -25,6 +25,7 @@ def get_connection_pool(
2525
host='127.0.0.1',
2626
port=6379,
2727
db=1,
28+
ssl=False,
2829
password=None,
2930
parser_class=None,
3031
unix_socket_path=None,
@@ -42,7 +43,9 @@ def get_connection_pool(
4243

4344
if pool is None:
4445
connection_class = (
45-
unix_socket_path and UnixDomainSocketConnection or Connection
46+
unix_socket_path and UnixDomainSocketConnection
47+
or ssl and SSLConnection
48+
or Connection
4649
)
4750

4851
kwargs = {

redis_cache/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def parse_connection_kwargs(server, db=None, **kwargs):
114114
pass
115115

116116
if url.scheme == 'rediss':
117-
url_options['connection_class'] = SSLConnection
117+
url_options['ssl'] = True
118118

119119
# last shot at the db value
120120
url_options['db'] = int(url_options.get('db', db or 0))

0 commit comments

Comments
 (0)