summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2017-09-22 22:01:12 -0400
committerGitHub <noreply@github.com>2017-09-22 22:01:12 -0400
commit9858a090ad0c01f7fa00ba9e04a655f4f91598d6 (patch)
tree65773781d2609a34238aaaf653288631d74a5907
parente5841967d08610b78c22bd02e52bdc436424367b (diff)
parent6dec9c1592829f313e7a8d31b1b692e49010ad15 (diff)
downloadredis-py-9858a090ad0c01f7fa00ba9e04a655f4f91598d6.tar.gz
Merge pull request #904 from swilly22/client_list_response_parsing
clientlist response, client_name value might contain the '=' character, in that case response parser will fail
-rwxr-xr-xredis/client.py3
-rw-r--r--tests/test_commands.py8
2 files changed, 10 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py
index 6383e55..e3b5ed7 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -245,7 +245,8 @@ def bool_ok(response):
def parse_client_list(response, **options):
clients = []
for c in nativestr(response).splitlines():
- clients.append(dict([pair.split('=') for pair in c.split(' ')]))
+ # Values might contain '='
+ clients.append(dict([pair.split('=', 1) for pair in c.split(' ')]))
return clients
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 04aeca4..ed46298 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -68,6 +68,14 @@ class TestRedisCommands(object):
assert r.client_setname('redis_py_test')
assert r.client_getname() == 'redis_py_test'
+ @skip_if_server_version_lt('2.6.9')
+ def test_client_list_after_client_setname(self, r):
+ r.client_setname('cl=i=ent')
+ clients = r.client_list()
+ assert isinstance(clients[0], dict)
+ assert 'name' in clients[0]
+ assert clients[0]['name'] == 'cl=i=ent'
+
def test_config_get(self, r):
data = r.config_get()
assert 'maxmemory' in data