Commit 52a29a12 authored by mrb's avatar mrb
Browse files

increase read depth by one, would allow ruby redis client to read from slowlog

parent 4aa31793
...@@ -446,10 +446,10 @@ static int processMultiBulkItem(redisReader *r) { ...@@ -446,10 +446,10 @@ static int processMultiBulkItem(redisReader *r) {
long elements; long elements;
int root = 0; int root = 0;
/* Set error for nested multi bulks with depth > 1 */ /* Set error for nested multi bulks with depth > 2 */
if (r->ridx == 2) { if (r->ridx == 3) {
__redisReaderSetError(r,REDIS_ERR_PROTOCOL, __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; return REDIS_ERR;
} }
......
...@@ -123,7 +123,7 @@ typedef struct redisReader { ...@@ -123,7 +123,7 @@ typedef struct redisReader {
size_t pos; /* Buffer cursor */ size_t pos; /* Buffer cursor */
size_t len; /* Buffer length */ size_t len; /* Buffer length */
redisReadTask rstack[3]; redisReadTask rstack[4];
int ridx; /* Index of current read task */ int ridx; /* Index of current read task */
void *reply; /* Temporary reply pointer */ void *reply; /* Temporary reply pointer */
......
...@@ -225,11 +225,12 @@ static void test_reply_reader(void) { ...@@ -225,11 +225,12 @@ static void test_reply_reader(void) {
strcasecmp(reader->errstr,"Protocol error, got \"@\" as reply type byte") == 0); strcasecmp(reader->errstr,"Protocol error, got \"@\" as reply type byte") == 0);
redisReaderFree(reader); redisReaderFree(reader);
test("Set error on nested multi bulks with depth > 1: "); test("Set error on nested multi bulks with depth > 2: ");
reader = redisReaderCreate(); 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);
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); ret = redisReaderGetReply(reader,NULL);
test_cond(ret == REDIS_ERR && test_cond(ret == REDIS_ERR &&
strncasecmp(reader->errstr,"No support for",14) == 0); strncasecmp(reader->errstr,"No support for",14) == 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment