summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2011-07-10 20:33:15 -0700
committerAndy McCurdy <andy@andymccurdy.com>2011-07-10 20:33:15 -0700
commit24b0f17a80b51ed2d7f7e1ca139428f27bf642c9 (patch)
treec4e2f2175beb8a451b3edbaee01b2370195fa2a5
parent194d29687dbb110d619b30274945832b2cab14d1 (diff)
downloadredis-py-24b0f17a80b51ed2d7f7e1ca139428f27bf642c9.tar.gz
Fix for #153, can only reliably check the last byte of the response
-rw-r--r--CHANGES1
-rw-r--r--redis/connection.py6
2 files changed, 4 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 64797b2..ffd5cae 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
* 2.4.6 (in development)
* Variadic arguments for SADD, SREM, ZREN, HDEL, LPUSH, and RPUSH. Thanks
Raphaƫl Vinot.
+ * Fix for #153, only check for \n rather than \r\n.
* 2.4.5
* The PythonParser now works better when reading zero length strings.
* 2.4.4
diff --git a/redis/connection.py b/redis/connection.py
index 2b48e32..ff7f277 100644
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -89,9 +89,9 @@ class HiredisParser(object):
if not buffer:
raise ConnectionError("Socket closed on remote end")
self._reader.feed(buffer)
- # if the data received doesn't end with \r\n, then there's more in
- # the socket
- if not buffer.endswith('\r\n'):
+ # proactively, but not conclusively, check if more data is in the
+ # buffer. if the data received doesn't end with \n, there's more.
+ if not buffer.endswith('\n'):
continue
response = self._reader.gets()
return response