sebleier / django-redis-cache

A Redis cache backend for django
http://django-redis-cache.readthedocs.org/en/latest/
Other
1.04k stars 223 forks source link

No scheme and no port cause Redis host to be incorrectly read as unix socket #172

Open particledecay opened 5 years ago

particledecay commented 5 years ago

When supplying an option for MASTER_CACHE as shown here, if you do not supply a port (only the hostname), the Redis host is mistakingly interpreted as a unix socket rather than an IP or hostname.

I realize that this is because of https://github.com/sebleier/django-redis-cache/blob/master/redis_cache/utils.py#L41, and since it doesn't find :// in the server (for the scheme) or : for the port, then it assumes it's a unix socket. I personally feel like it would be more common to have unix:// as an indicator for a socket than having an IP without a scheme or port.

Simple test: Set "MASTER_CACHE": "localhost".