diff options
author | Oran Agra <oran@redislabs.com> | 2018-11-18 16:46:59 +0200 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2018-11-18 16:46:59 +0200 |
commit | accbbdb2850f6286931fb82605702b672d2fd11e (patch) | |
tree | 7c3d45f1252c718f84c4aa6f6834067d22bd46d7 | |
parent | c8936f7c713e333c21dd7a6d5ecfa582bcafb535 (diff) | |
download | redis-py-accbbdb2850f6286931fb82605702b672d2fd11e.tar.gz |
Re-fix the recently broken INFO parsing, see #1018
The value part of the info line may contains : in many cases,
most importantly an IPv6 slave address, may cause the parser to crash.
-rwxr-xr-x | redis/client.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py index d62e20e..dcd8713 100755 --- a/redis/client.py +++ b/redis/client.py @@ -116,8 +116,12 @@ def parse_info(response): for line in response.splitlines(): if line and not line.startswith('#'): if line.find(':') != -1: - # support keys that include ':' by using rsplit - key, value = line.rsplit(':', 1) + # Split, the info fields keys and values. + # Note that the value may contain ':'. but the 'host:' + # pseudo-command is the only case where the key contains ':' + key, value = line.split(':', 1) + if key == 'cmdstat_host': + key, value = line.rsplit(':', 1) info[key] = get_value(value) else: # if the line isn't splittable, append it to the "__raw__" key |