Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
Django-Redis-Cache
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared
Django-Redis-Cache
Commits
18ea61fe
Commit
18ea61fe
authored
Mar 09, 2018
by
Mathieu Richardoz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash when establishing a secure connection
parent
f18bbb43
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
base.py
redis_cache/backends/base.py
+7
-0
connection.py
redis_cache/connection.py
+5
-2
utils.py
redis_cache/utils.py
+1
-3
No files found.
redis_cache/backends/base.py
View file @
18ea61fe
...
...
@@ -180,6 +180,13 @@ class BaseRedisCache(BaseCache):
socket_timeout
=
self
.
socket_timeout
,
socket_connect_timeout
=
self
.
socket_connect_timeout
,
)
# remove socket-related connection arguments
if
kwargs
.
get
(
'ssl'
,
False
):
del
kwargs
[
'socket_timeout'
]
del
kwargs
[
'socket_connect_timeout'
]
del
kwargs
[
'unix_socket_path'
]
client
=
redis
.
Redis
(
**
kwargs
)
kwargs
.
update
(
parser_class
=
self
.
parser_class
,
...
...
redis_cache/connection.py
View file @
18ea61fe
from
redis.connection
import
UnixDomainSocketConnection
,
Connection
from
redis.connection
import
UnixDomainSocketConnection
,
SSLConnection
,
Connection
class
CacheConnectionPool
(
object
):
...
...
@@ -24,6 +24,7 @@ class CacheConnectionPool(object):
client
,
host
=
'127.0.0.1'
,
port
=
6379
,
ssl
=
False
,
db
=
1
,
password
=
None
,
parser_class
=
None
,
...
...
@@ -42,7 +43,9 @@ class CacheConnectionPool(object):
if
pool
is
None
:
connection_class
=
(
unix_socket_path
and
UnixDomainSocketConnection
or
Connection
unix_socket_path
and
UnixDomainSocketConnection
or
ssl
and
SSLConnection
or
Connection
)
kwargs
=
{
...
...
redis_cache/utils.py
View file @
18ea61fe
...
...
@@ -6,8 +6,6 @@ from django.utils import six
from
django.utils.encoding
import
force_text
,
python_2_unicode_compatible
from
django.utils.six.moves.urllib.parse
import
parse_qs
,
urlparse
from
redis.connection
import
SSLConnection
@
python_2_unicode_compatible
class
CacheKey
(
object
):
...
...
@@ -134,7 +132,7 @@ def parse_connection_kwargs(server, db=None, **kwargs):
pass
if
url
.
scheme
==
'rediss'
:
url_options
[
'
connection_class'
]
=
SSLConnection
url_options
[
'
ssl'
]
=
True
# last shot at the db value
url_options
[
'db'
]
=
int
(
url_options
.
get
(
'db'
,
db
or
0
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment