summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb <michaelrbernstein@gmail.com>2011-12-02 08:45:13 -0500
committermrb <michaelrbernstein@gmail.com>2011-12-02 08:45:13 -0500
commit52a29a124bec34b570f8b1f6817817e8aa0e5791 (patch)
treec0da717f7d9198d2ef55bf8f9f9a3512f3a17fdd
parent4aa3179332febf14b373af727512e5dc8b4e1ac8 (diff)
increase read depth by one, would allow ruby redis client to read from slowlog
-rw-r--r--hiredis.c6
-rw-r--r--hiredis.h2
-rw-r--r--test.c3
3 files changed, 6 insertions, 5 deletions
diff --git a/hiredis.c b/hiredis.c
index 4247b82..ac5c3e3 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -446,10 +446,10 @@ static int processMultiBulkItem(redisReader *r) {
long elements;
int root = 0;
- /* Set error for nested multi bulks with depth > 1 */
- if (r->ridx == 2) {
+ /* Set error for nested multi bulks with depth > 2 */
+ if (r->ridx == 3) {
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
- "No support for nested multi bulk replies with depth > 1");
+ "No support for nested multi bulk replies with depth > 2");
return REDIS_ERR;
}
diff --git a/hiredis.h b/hiredis.h
index 3c3491c..8358375 100644
--- a/hiredis.h
+++ b/hiredis.h
@@ -123,7 +123,7 @@ typedef struct redisReader {
size_t pos; /* Buffer cursor */
size_t len; /* Buffer length */
- redisReadTask rstack[3];
+ redisReadTask rstack[4];
int ridx; /* Index of current read task */
void *reply; /* Temporary reply pointer */
diff --git a/test.c b/test.c
index 0dde686..ca98f9b 100644
--- a/test.c
+++ b/test.c
@@ -225,11 +225,12 @@ static void test_reply_reader(void) {
strcasecmp(reader->errstr,"Protocol error, got \"@\" as reply type byte") == 0);
redisReaderFree(reader);
- test("Set error on nested multi bulks with depth > 1: ");
+ test("Set error on nested multi bulks with depth > 2: ");
reader = redisReaderCreate();
redisReaderFeed(reader,(char*)"*1\r\n",4);
redisReaderFeed(reader,(char*)"*1\r\n",4);
redisReaderFeed(reader,(char*)"*1\r\n",4);
+ redisReaderFeed(reader,(char*)"*1\r\n",4);
ret = redisReaderGetReply(reader,NULL);
test_cond(ret == REDIS_ERR &&
strncasecmp(reader->errstr,"No support for",14) == 0);