Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed the multi-bulk parser: we did not allow zero digit in the bulk …

…count number. sigh. and we did not allow empty multi bulk list. also applied some minor optimizations there.
  • Loading branch information...
commit 62f5b6a3fe629f7bf30f50586dd5e1b025b1ebb0 1 parent 74bc096
@agentzh agentzh authored
View
20 src/common.rl
@@ -1,7 +1,11 @@
%%{
machine common;
- CRLF = "\r\n";
+ action read_char {
+ dd("reading %c", *p);
+ }
+
+ CRLF = "\r\n"; # $read_char;
action finalize {
dd("done!");
@@ -15,14 +19,21 @@
}
action start_reading_size {
+ dd("start reading chunk size");
+ ctx->chunk_bytes_read = 0;
ctx->chunk_size = 0;
}
action start_reading_data {
+ dd("start reading data");
ctx->chunk_bytes_read = 0;
}
action test_len {
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
}
@@ -32,13 +43,12 @@
chunk_data_octet = any when test_len
;
- chunk_data = chunk_data_octet+
- >start_reading_data
- ;
+ chunk_data = chunk_data_octet+;
action read_chunk {
ctx->chunks_read++;
- dd("read chunk %d", (int) ctx->chunks_read);
+ dd("have read chunk %d, %.*s", (int) ctx->chunks_read,
+ (int) (p - (char *) b->last), (char *) b->last);
}
trailer = CRLF @read_chunk
View
33 src/multi_bulk_reply.rl
@@ -4,14 +4,20 @@
include common "common.rl";
action test_chunk_count {
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
}
action start_reading_chunk {
+ dd("start reading bulk");
ctx->chunks_read = 0;
}
action start_reading_count {
+ dd("start reading bulk count");
ctx->chunk_count = 0;
}
@@ -21,25 +27,28 @@
dd("chunk count: %d", (int) ctx->chunk_count);
}
- protected_chunk = chunk when test_chunk_count
- ;
-
- chunk_count = (digit+ -- "0"+) >start_reading_count $read_count
- ;
-
- response = "*" chunk_count CRLF
- (protected_chunk+ >start_reading_chunk)
- ;
-
action multi_bulk_finalize {
- dd("done!");
+ dd("finalize multi bulks");
+
if (ctx->chunks_read == ctx->chunk_count) {
+ dd("done multi bunlk reading!");
done = 1;
}
}
+ protected_chunk = chunk when test_chunk_count
+ ;
+
+ chunk_count = ([1-9] digit*) >start_reading_count $read_count
+ ;
+
+ response = "*" "0"+ CRLF @multi_bulk_finalize
+ | "*" chunk_count CRLF
+ (protected_chunk+ >start_reading_chunk)
+ @multi_bulk_finalize
+ ;
- main := response @multi_bulk_finalize
+ main := response
;
}%%
View
1,081 src/ngx_http_redis2_reply.c
@@ -38,7 +38,7 @@ static const int bulk_reply_en_main = 1;
#line 40 "src/ngx_http_redis2_reply.c"
static const int multi_bulk_reply_start = 1;
-static const int multi_bulk_reply_first_final = 26;
+static const int multi_bulk_reply_first_final = 28;
static const int multi_bulk_reply_error = 0;
static const int multi_bulk_reply_en_main = 1;
@@ -119,7 +119,7 @@ case 3:
}
goto st2;
tr2:
-#line 6 "src/common.rl"
+#line 10 "src/common.rl"
{
dd("done!");
done = 1;
@@ -272,12 +272,13 @@ case 5:
goto tr7;
goto st0;
tr7:
-#line 39 "src/common.rl"
+#line 48 "src/common.rl"
{
ctx->chunks_read++;
- dd("read chunk %d", (int) ctx->chunks_read);
+ dd("have read chunk %d, %.*s", (int) ctx->chunks_read,
+ (int) (p - (char *) b->last), (char *) b->last);
}
-#line 6 "src/common.rl"
+#line 10 "src/common.rl"
{
dd("done!");
done = 1;
@@ -287,7 +288,7 @@ case 5:
if ( ++p == pe )
goto _test_eof14;
case 14:
-#line 291 "src/ngx_http_redis2_reply.c"
+#line 292 "src/ngx_http_redis2_reply.c"
goto st0;
st6:
if ( ++p == pe )
@@ -313,11 +314,13 @@ case 8:
goto st5;
goto st0;
tr4:
-#line 17 "src/common.rl"
+#line 21 "src/common.rl"
{
+ dd("start reading chunk size");
+ ctx->chunk_bytes_read = 0;
ctx->chunk_size = 0;
}
-#line 11 "src/common.rl"
+#line 15 "src/common.rl"
{
ctx->chunk_size *= 10;
ctx->chunk_size += *p - '0';
@@ -325,7 +328,7 @@ case 8:
}
goto st9;
tr11:
-#line 11 "src/common.rl"
+#line 15 "src/common.rl"
{
ctx->chunk_size *= 10;
ctx->chunk_size += *p - '0';
@@ -336,7 +339,7 @@ case 8:
if ( ++p == pe )
goto _test_eof9;
case 9:
-#line 340 "src/ngx_http_redis2_reply.c"
+#line 343 "src/ngx_http_redis2_reply.c"
if ( (*p) == 13 )
goto st10;
if ( 48 <= (*p) && (*p) <= 57 )
@@ -356,29 +359,30 @@ case 11:
_widec = (*p);
_widec = (short)(128 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if ( 384 <= _widec && _widec <= 639 )
- goto tr13;
+ goto st12;
goto st0;
-tr13:
-#line 21 "src/common.rl"
- {
- ctx->chunk_bytes_read = 0;
- }
- goto st12;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
-#line 377 "src/ngx_http_redis2_reply.c"
_widec = (*p);
_widec = (short)(128 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
switch( _widec ) {
@@ -395,26 +399,31 @@ case 13:
_widec = (*p);
_widec = (short)(128 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
switch( _widec ) {
case 266: goto tr7;
case 269: goto st5;
- case 522: goto tr16;
+ case 522: goto tr15;
case 525: goto st13;
}
if ( 384 <= _widec && _widec <= 639 )
goto st12;
goto st0;
-tr16:
-#line 39 "src/common.rl"
+tr15:
+#line 48 "src/common.rl"
{
ctx->chunks_read++;
- dd("read chunk %d", (int) ctx->chunks_read);
+ dd("have read chunk %d, %.*s", (int) ctx->chunks_read,
+ (int) (p - (char *) b->last), (char *) b->last);
}
-#line 6 "src/common.rl"
+#line 10 "src/common.rl"
{
dd("done!");
done = 1;
@@ -424,12 +433,16 @@ case 13:
if ( ++p == pe )
goto _test_eof15;
case 15:
-#line 428 "src/ngx_http_redis2_reply.c"
+#line 437 "src/ngx_http_redis2_reply.c"
_widec = (*p);
_widec = (short)(128 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
switch( _widec ) {
@@ -520,7 +533,7 @@ ngx_http_redis2_process_multi_bulk_reply(ngx_http_redis2_ctx_t *ctx,
#line 184 "src/ngx_http_redis2_reply.rl"
-#line 524 "src/ngx_http_redis2_reply.c"
+#line 537 "src/ngx_http_redis2_reply.c"
{
cs = multi_bulk_reply_start;
}
@@ -542,7 +555,7 @@ ngx_http_redis2_process_multi_bulk_reply(ngx_http_redis2_ctx_t *ctx,
#line 198 "src/ngx_http_redis2_reply.rl"
-#line 546 "src/ngx_http_redis2_reply.c"
+#line 559 "src/ngx_http_redis2_reply.c"
{
short _widec;
if ( p == pe )
@@ -560,73 +573,114 @@ cs = 0;
if ( ++p == pe )
goto _test_eof2;
case 2:
+ if ( (*p) == 48 )
+ goto st3;
if ( 49 <= (*p) && (*p) <= 57 )
- goto tr2;
+ goto tr3;
goto st0;
-tr2:
-#line 14 "src/multi_bulk_reply.rl"
+st3:
+ if ( ++p == pe )
+ goto _test_eof3;
+case 3:
+ switch( (*p) ) {
+ case 13: goto st4;
+ case 48: goto st3;
+ }
+ goto st0;
+st4:
+ if ( ++p == pe )
+ goto _test_eof4;
+case 4:
+ if ( (*p) == 10 )
+ goto tr5;
+ goto st0;
+tr5:
+#line 30 "src/multi_bulk_reply.rl"
{
+ dd("finalize multi bulks");
+
+ if (ctx->chunks_read == ctx->chunk_count) {
+ dd("done multi bunlk reading!");
+ done = 1;
+ }
+ }
+ goto st28;
+st28:
+ if ( ++p == pe )
+ goto _test_eof28;
+case 28:
+#line 613 "src/ngx_http_redis2_reply.c"
+ goto st0;
+tr3:
+#line 19 "src/multi_bulk_reply.rl"
+ {
+ dd("start reading bulk count");
ctx->chunk_count = 0;
}
-#line 18 "src/multi_bulk_reply.rl"
+#line 24 "src/multi_bulk_reply.rl"
{
ctx->chunk_count *= 10;
ctx->chunk_count += *p - '0';
dd("chunk count: %d", (int) ctx->chunk_count);
}
- goto st3;
-tr4:
-#line 18 "src/multi_bulk_reply.rl"
+ goto st5;
+tr7:
+#line 24 "src/multi_bulk_reply.rl"
{
ctx->chunk_count *= 10;
ctx->chunk_count += *p - '0';
dd("chunk count: %d", (int) ctx->chunk_count);
}
- goto st3;
-st3:
+ goto st5;
+st5:
if ( ++p == pe )
- goto _test_eof3;
-case 3:
-#line 591 "src/ngx_http_redis2_reply.c"
+ goto _test_eof5;
+case 5:
+#line 640 "src/ngx_http_redis2_reply.c"
if ( (*p) == 13 )
- goto st4;
- if ( 49 <= (*p) && (*p) <= 57 )
- goto tr4;
+ goto st6;
+ if ( 48 <= (*p) && (*p) <= 57 )
+ goto tr7;
goto st0;
-st4:
+st6:
if ( ++p == pe )
- goto _test_eof4;
-case 4:
+ goto _test_eof6;
+case 6:
if ( (*p) == 10 )
- goto st5;
+ goto st7;
goto st0;
-st5:
+st7:
if ( ++p == pe )
- goto _test_eof5;
-case 5:
+ goto _test_eof7;
+case 7:
_widec = (*p);
if ( 36 <= (*p) && (*p) <= 36 ) {
_widec = (short)(1664 + ((*p) - -128));
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2084 )
- goto tr6;
+ goto tr9;
goto st0;
-tr6:
-#line 10 "src/multi_bulk_reply.rl"
+tr9:
+#line 14 "src/multi_bulk_reply.rl"
{
+ dd("start reading bulk");
ctx->chunks_read = 0;
}
- goto st6;
-st6:
+ goto st8;
+st8:
if ( ++p == pe )
- goto _test_eof6;
-case 6:
-#line 630 "src/ngx_http_redis2_reply.c"
+ goto _test_eof8;
+case 8:
+#line 684 "src/ngx_http_redis2_reply.c"
_widec = (*p);
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 45 ) {
@@ -634,6 +688,10 @@ case 6:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
@@ -643,6 +701,10 @@ case 6:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
@@ -651,36 +713,44 @@ case 6:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
switch( _widec ) {
- case 2093: goto st7;
- case 2096: goto st10;
+ case 2093: goto st9;
+ case 2096: goto st12;
}
if ( 2097 <= _widec && _widec <= 2105 )
- goto tr9;
+ goto tr12;
goto st0;
-st7:
+st9:
if ( ++p == pe )
- goto _test_eof7;
-case 7:
+ goto _test_eof9;
+case 9:
_widec = (*p);
if ( 48 <= (*p) && (*p) <= 57 ) {
_widec = (short)(1664 + ((*p) - -128));
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( 2096 <= _widec && _widec <= 2105 )
- goto st8;
+ goto st10;
goto st0;
-st8:
+st10:
if ( ++p == pe )
- goto _test_eof8;
-case 8:
+ goto _test_eof10;
+case 10:
_widec = (*p);
if ( (*p) > 13 ) {
if ( 48 <= (*p) && (*p) <= 57 ) {
@@ -688,6 +758,10 @@ case 8:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
@@ -696,65 +770,80 @@ case 8:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2061 )
- goto st9;
+ goto st11;
if ( 2096 <= _widec && _widec <= 2105 )
- goto st8;
+ goto st10;
goto st0;
-st9:
+st11:
if ( ++p == pe )
- goto _test_eof9;
-case 9:
+ goto _test_eof11;
+case 11:
_widec = (*p);
if ( 10 <= (*p) && (*p) <= 10 ) {
_widec = (short)(1664 + ((*p) - -128));
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2058 )
- goto tr12;
+ goto tr15;
goto st0;
-tr12:
-#line 39 "src/common.rl"
+tr15:
+#line 48 "src/common.rl"
{
ctx->chunks_read++;
- dd("read chunk %d", (int) ctx->chunks_read);
+ dd("have read chunk %d, %.*s", (int) ctx->chunks_read,
+ (int) (p - (char *) b->last), (char *) b->last);
}
-#line 34 "src/multi_bulk_reply.rl"
+#line 30 "src/multi_bulk_reply.rl"
{
- dd("done!");
+ dd("finalize multi bulks");
+
if (ctx->chunks_read == ctx->chunk_count) {
+ dd("done multi bunlk reading!");
done = 1;
}
}
- goto st26;
-st26:
+ goto st29;
+st29:
if ( ++p == pe )
- goto _test_eof26;
-case 26:
-#line 742 "src/ngx_http_redis2_reply.c"
+ goto _test_eof29;
+case 29:
+#line 827 "src/ngx_http_redis2_reply.c"
_widec = (*p);
if ( 36 <= (*p) && (*p) <= 36 ) {
_widec = (short)(1664 + ((*p) - -128));
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2084 )
- goto st6;
+ goto st8;
goto st0;
-st10:
+st12:
if ( ++p == pe )
- goto _test_eof10;
-case 10:
+ goto _test_eof12;
+case 12:
_widec = (*p);
if ( (*p) > 13 ) {
if ( 48 <= (*p) && (*p) <= 48 ) {
@@ -762,6 +851,10 @@ case 10:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
@@ -770,71 +863,85 @@ case 10:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
switch( _widec ) {
- case 2061: goto st11;
- case 2096: goto st10;
+ case 2061: goto st13;
+ case 2096: goto st12;
}
goto st0;
-st11:
+st13:
if ( ++p == pe )
- goto _test_eof11;
-case 11:
+ goto _test_eof13;
+case 13:
_widec = (*p);
if ( 10 <= (*p) && (*p) <= 10 ) {
_widec = (short)(1664 + ((*p) - -128));
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2058 )
- goto st12;
+ goto st14;
goto st0;
-st12:
+st14:
if ( ++p == pe )
- goto _test_eof12;
-case 12:
+ goto _test_eof14;
+case 14:
_widec = (*p);
if ( 13 <= (*p) && (*p) <= 13 ) {
_widec = (short)(1664 + ((*p) - -128));
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2061 )
- goto st9;
+ goto st11;
goto st0;
-tr9:
-#line 17 "src/common.rl"
+tr12:
+#line 21 "src/common.rl"
{
+ dd("start reading chunk size");
+ ctx->chunk_bytes_read = 0;
ctx->chunk_size = 0;
}
-#line 11 "src/common.rl"
+#line 15 "src/common.rl"
{
ctx->chunk_size *= 10;
ctx->chunk_size += *p - '0';
dd("read chunk size: %d", (int) ctx->chunk_size);
}
- goto st13;
-tr16:
-#line 11 "src/common.rl"
+ goto st15;
+tr19:
+#line 15 "src/common.rl"
{
ctx->chunk_size *= 10;
ctx->chunk_size += *p - '0';
dd("read chunk size: %d", (int) ctx->chunk_size);
}
- goto st13;
-st13:
+ goto st15;
+st15:
if ( ++p == pe )
- goto _test_eof13;
-case 13:
-#line 838 "src/ngx_http_redis2_reply.c"
+ goto _test_eof15;
+case 15:
+#line 945 "src/ngx_http_redis2_reply.c"
_widec = (*p);
if ( (*p) > 13 ) {
if ( 48 <= (*p) && (*p) <= 57 ) {
@@ -842,6 +949,10 @@ case 13:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
@@ -850,142 +961,171 @@ case 13:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2061 )
- goto st14;
+ goto st16;
if ( 2096 <= _widec && _widec <= 2105 )
- goto tr16;
+ goto tr19;
goto st0;
-st14:
+st16:
if ( ++p == pe )
- goto _test_eof14;
-case 14:
+ goto _test_eof16;
+case 16:
_widec = (*p);
if ( 10 <= (*p) && (*p) <= 10 ) {
_widec = (short)(1664 + ((*p) - -128));
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2058 )
- goto st15;
+ goto st17;
goto st0;
-st15:
+st17:
if ( ++p == pe )
- goto _test_eof15;
-case 15:
+ goto _test_eof17;
+case 17:
_widec = (*p);
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
if ( 1408 <= _widec && _widec <= 1663 )
- goto tr18;
+ goto st18;
goto st0;
-tr18:
-#line 21 "src/common.rl"
- {
- ctx->chunk_bytes_read = 0;
- }
- goto st16;
-st16:
+st18:
if ( ++p == pe )
- goto _test_eof16;
-case 16:
-#line 907 "src/ngx_http_redis2_reply.c"
+ goto _test_eof18;
+case 18:
_widec = (*p);
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
switch( _widec ) {
- case 1293: goto st9;
- case 1549: goto st17;
+ case 1293: goto st11;
+ case 1549: goto st19;
}
if ( 1408 <= _widec && _widec <= 1663 )
- goto st16;
+ goto st18;
goto st0;
-tr36:
-#line 21 "src/common.rl"
- {
- ctx->chunk_bytes_read = 0;
- }
- goto st17;
-st17:
+st19:
if ( ++p == pe )
- goto _test_eof17;
-case 17:
-#line 937 "src/ngx_http_redis2_reply.c"
+ goto _test_eof19;
+case 19:
_widec = (*p);
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
switch( _widec ) {
- case 1290: goto tr12;
- case 1293: goto st9;
- case 1546: goto tr21;
- case 1549: goto st17;
+ case 1290: goto tr15;
+ case 1293: goto st11;
+ case 1546: goto tr23;
+ case 1549: goto st19;
}
if ( 1408 <= _widec && _widec <= 1663 )
- goto st16;
+ goto st18;
goto st0;
-tr21:
-#line 39 "src/common.rl"
+tr23:
+#line 48 "src/common.rl"
{
ctx->chunks_read++;
- dd("read chunk %d", (int) ctx->chunks_read);
+ dd("have read chunk %d, %.*s", (int) ctx->chunks_read,
+ (int) (p - (char *) b->last), (char *) b->last);
}
-#line 34 "src/multi_bulk_reply.rl"
+#line 30 "src/multi_bulk_reply.rl"
{
- dd("done!");
+ dd("finalize multi bulks");
+
if (ctx->chunks_read == ctx->chunk_count) {
+ dd("done multi bunlk reading!");
done = 1;
}
}
- goto st27;
-st27:
+ goto st30;
+st30:
if ( ++p == pe )
- goto _test_eof27;
-case 27:
-#line 977 "src/ngx_http_redis2_reply.c"
+ goto _test_eof30;
+case 30:
+#line 1109 "src/ngx_http_redis2_reply.c"
_widec = (*p);
if ( (*p) < 36 ) {
if ( (*p) <= 35 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
@@ -993,75 +1133,100 @@ case 27:
if ( 37 <= (*p) )
{ _widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
switch( _widec ) {
- case 1293: goto st9;
- case 1316: goto st6;
- case 1549: goto st17;
- case 1572: goto st18;
+ case 1293: goto st11;
+ case 1316: goto st8;
+ case 1549: goto st19;
+ case 1572: goto st20;
}
if ( 1408 <= _widec && _widec <= 1663 )
- goto st16;
+ goto st18;
goto st0;
-tr35:
-#line 21 "src/common.rl"
- {
- ctx->chunk_bytes_read = 0;
- }
- goto st18;
-st18:
+st20:
if ( ++p == pe )
- goto _test_eof18;
-case 18:
-#line 1039 "src/ngx_http_redis2_reply.c"
+ goto _test_eof20;
+case 20:
_widec = (*p);
if ( (*p) < 46 ) {
if ( (*p) > 44 ) {
if ( 45 <= (*p) && (*p) <= 45 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
@@ -1070,13 +1235,21 @@ case 18:
if ( 48 <= (*p) && (*p) <= 48 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
@@ -1084,78 +1257,110 @@ case 18:
if ( 58 <= (*p) )
{ _widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
switch( _widec ) {
- case 1293: goto st9;
- case 1325: goto st7;
- case 1328: goto st10;
- case 1549: goto st17;
- case 1581: goto st19;
- case 1584: goto st20;
+ case 1293: goto st11;
+ case 1325: goto st9;
+ case 1328: goto st12;
+ case 1549: goto st19;
+ case 1581: goto st21;
+ case 1584: goto st22;
}
if ( _widec < 1408 ) {
if ( 1329 <= _widec && _widec <= 1337 )
- goto tr9;
+ goto tr12;
} else if ( _widec > 1583 ) {
if ( _widec > 1593 ) {
if ( 1594 <= _widec && _widec <= 1663 )
- goto st16;
+ goto st18;
} else if ( _widec >= 1585 )
- goto tr24;
+ goto tr26;
} else
- goto st16;
+ goto st18;
goto st0;
-st19:
+st21:
if ( ++p == pe )
- goto _test_eof19;
-case 19:
+ goto _test_eof21;
+case 21:
_widec = (*p);
if ( (*p) < 48 ) {
if ( (*p) <= 47 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
@@ -1163,75 +1368,107 @@ case 19:
if ( 58 <= (*p) )
{ _widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
switch( _widec ) {
- case 1293: goto st9;
- case 1549: goto st17;
+ case 1293: goto st11;
+ case 1549: goto st19;
}
if ( _widec < 1408 ) {
if ( 1328 <= _widec && _widec <= 1337 )
- goto st8;
+ goto st10;
} else if ( _widec > 1583 ) {
if ( _widec > 1593 ) {
if ( 1594 <= _widec && _widec <= 1663 )
- goto st16;
+ goto st18;
} else if ( _widec >= 1584 )
- goto st19;
+ goto st21;
} else
- goto st16;
+ goto st18;
goto st0;
-st20:
+st22:
if ( ++p == pe )
- goto _test_eof20;
-case 20:
+ goto _test_eof22;
+case 22:
_widec = (*p);
if ( (*p) < 14 ) {
if ( (*p) > 12 ) {
if ( 13 <= (*p) && (*p) <= 13 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
@@ -1240,86 +1477,117 @@ case 20:
if ( 49 <= (*p) )
{ _widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else if ( (*p) >= 48 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
switch( _widec ) {
- case 1293: goto st21;
- case 1328: goto st10;
- case 1549: goto st22;
- case 1584: goto st20;
+ case 1293: goto st23;
+ case 1328: goto st12;
+ case 1549: goto st24;
+ case 1584: goto st22;
}
if ( 1408 <= _widec && _widec <= 1663 )
- goto st16;
+ goto st18;
goto st0;
-st21:
+st23:
if ( ++p == pe )
- goto _test_eof21;
-case 21:
+ goto _test_eof23;
+case 23:
_widec = (*p);
if ( 10 <= (*p) && (*p) <= 10 ) {
_widec = (short)(1664 + ((*p) - -128));
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2058 )
- goto tr27;
+ goto tr29;
goto st0;
-tr27:
-#line 39 "src/common.rl"
+tr29:
+#line 48 "src/common.rl"
{
ctx->chunks_read++;
- dd("read chunk %d", (int) ctx->chunks_read);
+ dd("have read chunk %d, %.*s", (int) ctx->chunks_read,
+ (int) (p - (char *) b->last), (char *) b->last);
}
-#line 34 "src/multi_bulk_reply.rl"
+#line 30 "src/multi_bulk_reply.rl"
{
- dd("done!");
+ dd("finalize multi bulks");
+
if (ctx->chunks_read == ctx->chunk_count) {
+ dd("done multi bunlk reading!");
done = 1;
}
}
- goto st28;
-st28:
+ goto st31;
+st31:
if ( ++p == pe )
- goto _test_eof28;
-case 28:
-#line 1323 "src/ngx_http_redis2_reply.c"
+ goto _test_eof31;
+case 31:
+#line 1591 "src/ngx_http_redis2_reply.c"
_widec = (*p);
if ( (*p) > 13 ) {
if ( 36 <= (*p) && (*p) <= 36 ) {
@@ -1327,6 +1595,10 @@ case 28:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
@@ -1335,30 +1607,42 @@ case 28:
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
switch( _widec ) {
- case 2061: goto st9;
- case 2084: goto st6;
+ case 2061: goto st11;
+ case 2084: goto st8;
}
goto st0;
-st22:
+st24:
if ( ++p == pe )
- goto _test_eof22;
-case 22:
+ goto _test_eof24;
+case 24:
_widec = (*p);
if ( (*p) < 10 ) {
if ( (*p) <= 9 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
@@ -1366,89 +1650,123 @@ case 22:
if ( 11 <= (*p) )
{ _widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
switch( _widec ) {
- case 1290: goto tr27;
- case 1293: goto st9;
- case 1546: goto tr21;
- case 1549: goto st17;
+ case 1290: goto tr29;
+ case 1293: goto st11;
+ case 1546: goto tr23;
+ case 1549: goto st19;
}
if ( 1408 <= _widec && _widec <= 1663 )
- goto st16;
+ goto st18;
goto st0;
-tr24:
-#line 17 "src/common.rl"
+tr26:
+#line 21 "src/common.rl"
{
+ dd("start reading chunk size");
+ ctx->chunk_bytes_read = 0;
ctx->chunk_size = 0;
}
-#line 11 "src/common.rl"
+#line 15 "src/common.rl"
{
ctx->chunk_size *= 10;
ctx->chunk_size += *p - '0';
dd("read chunk size: %d", (int) ctx->chunk_size);
}
- goto st23;
-tr30:
-#line 11 "src/common.rl"
+ goto st25;
+tr32:
+#line 15 "src/common.rl"
{
ctx->chunk_size *= 10;
ctx->chunk_size += *p - '0';
dd("read chunk size: %d", (int) ctx->chunk_size);
}
- goto st23;
-st23:
+ goto st25;
+st25:
if ( ++p == pe )
- goto _test_eof23;
-case 23:
-#line 1426 "src/ngx_http_redis2_reply.c"
+ goto _test_eof25;
+case 25:
+#line 1728 "src/ngx_http_redis2_reply.c"
_widec = (*p);
if ( (*p) < 14 ) {
if ( (*p) > 12 ) {
if ( 13 <= (*p) && (*p) <= 13 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
@@ -1457,105 +1775,144 @@ case 23:
if ( 58 <= (*p) )
{ _widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else if ( (*p) >= 48 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
switch( _widec ) {
- case 1293: goto st24;
- case 1549: goto st25;
+ case 1293: goto st26;
+ case 1549: goto st27;
}
if ( _widec < 1408 ) {
if ( 1328 <= _widec && _widec <= 1337 )
- goto tr16;
+ goto tr19;
} else if ( _widec > 1583 ) {
if ( _widec > 1593 ) {
if ( 1594 <= _widec && _widec <= 1663 )
- goto st16;
+ goto st18;
} else if ( _widec >= 1584 )
- goto tr30;
+ goto tr32;
} else
- goto st16;
+ goto st18;
goto st0;
-st24:
+st26:
if ( ++p == pe )
- goto _test_eof24;
-case 24:
+ goto _test_eof26;
+case 26:
_widec = (*p);
if ( 10 <= (*p) && (*p) <= 10 ) {
_widec = (short)(1664 + ((*p) - -128));
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 256;
}
if ( _widec == 2058 )
- goto tr31;
+ goto tr33;
goto st0;
-tr31:
-#line 39 "src/common.rl"
+tr33:
+#line 48 "src/common.rl"
{
ctx->chunks_read++;
- dd("read chunk %d", (int) ctx->chunks_read);
+ dd("have read chunk %d, %.*s", (int) ctx->chunks_read,
+ (int) (p - (char *) b->last), (char *) b->last);
}
-#line 34 "src/multi_bulk_reply.rl"
+#line 30 "src/multi_bulk_reply.rl"
{
- dd("done!");
+ dd("finalize multi bulks");
+
if (ctx->chunks_read == ctx->chunk_count) {
+ dd("done multi bunlk reading!");
done = 1;
}
}
- goto st29;
-st29:
+ goto st32;
+st32:
if ( ++p == pe )
- goto _test_eof29;
-case 29:
-#line 1547 "src/ngx_http_redis2_reply.c"
+ goto _test_eof32;
+case 32:
+#line 1896 "src/ngx_http_redis2_reply.c"
_widec = (*p);
if ( (*p) < 36 ) {
if ( (*p) <= 35 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
@@ -1563,52 +1920,76 @@ case 29:
if ( 37 <= (*p) )
{ _widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
switch( _widec ) {
- case 1316: goto st6;
- case 1572: goto tr35;
+ case 1316: goto st8;
+ case 1572: goto st20;
}
if ( 1408 <= _widec && _widec <= 1663 )
- goto tr18;
+ goto st18;
goto st0;
-st25:
+st27:
if ( ++p == pe )
- goto _test_eof25;
-case 25:
+ goto _test_eof27;
+case 27:
_widec = (*p);
if ( (*p) < 10 ) {
if ( (*p) <= 9 ) {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
@@ -1616,138 +1997,86 @@ case 25:
if ( 11 <= (*p) )
{ _widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
-
- ctx->chunk_bytes_read++ < ctx->chunk_size
- ) _widec += 256;
- if (
-#line 6 "src/multi_bulk_reply.rl"
-
- ctx->chunks_read < ctx->chunk_count
- ) _widec += 512;
- }
- } else {
- _widec = (short)(640 + ((*p) - -128));
- if (
-#line 25 "src/common.rl"
-
- ctx->chunk_bytes_read++ < ctx->chunk_size
- ) _widec += 256;
- if (
-#line 6 "src/multi_bulk_reply.rl"
-
- ctx->chunks_read < ctx->chunk_count
- ) _widec += 512;
- }
- switch( _widec ) {
- case 1290: goto tr31;
- case 1293: goto st9;
- case 1546: goto tr32;
- case 1549: goto st17;
- }
- if ( 1408 <= _widec && _widec <= 1663 )
- goto st16;
- goto st0;
-tr32:
-#line 39 "src/common.rl"
- {
- ctx->chunks_read++;
- dd("read chunk %d", (int) ctx->chunks_read);
- }
-#line 34 "src/multi_bulk_reply.rl"
- {
- dd("done!");
- if (ctx->chunks_read == ctx->chunk_count) {
- done = 1;
- }
- }
- goto st30;
-st30:
- if ( ++p == pe )
- goto _test_eof30;
-case 30:
-#line 1670 "src/ngx_http_redis2_reply.c"
- _widec = (*p);
- if ( (*p) < 36 ) {
- if ( (*p) <= 35 ) {
- _widec = (short)(640 + ((*p) - -128));
- if (
-#line 25 "src/common.rl"
-
- ctx->chunk_bytes_read++ < ctx->chunk_size
- ) _widec += 256;
- if (
-#line 6 "src/multi_bulk_reply.rl"
-
- ctx->chunks_read < ctx->chunk_count
- ) _widec += 512;
- }
- } else if ( (*p) > 36 ) {
- if ( 37 <= (*p) )
- { _widec = (short)(640 + ((*p) - -128));
- if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
} else {
_widec = (short)(640 + ((*p) - -128));
if (
-#line 25 "src/common.rl"
+#line 32 "src/common.rl"
+#if 0
+ fprintf(stderr, "test chunk len: %d < %d\n",
+ (int) ctx->chunk_bytes_read, (int) ctx->chunk_size),
+#endif
ctx->chunk_bytes_read++ < ctx->chunk_size
) _widec += 256;
if (
#line 6 "src/multi_bulk_reply.rl"
+#if 0
+ fprintf(stderr, "test chunk count: %d < %d\n",
+ (int) ctx->chunks_read, (int) ctx->chunk_count),
+#endif
ctx->chunks_read < ctx->chunk_count
) _widec += 512;
}
switch( _widec ) {
- case 1293: goto st9;
- case 1316: goto st6;
- case 1549: goto tr36;
- case 1572: goto tr35;
+ case 1290: goto tr33;
+ case 1293: goto st11;
+ case 1546: goto tr23;
+ case 1549: goto st19;
}
if ( 1408 <= _widec && _widec <= 1663 )
- goto tr18;
+ goto st18;
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
+ _test_eof28: cs = 28; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
- _test_eof26: cs = 26; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
+ _test_eof29: cs = 29; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
- _test_eof27: cs = 27; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
+ _test_eof30: cs = 30; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_test_eof21: cs = 21; goto _test_eof;
- _test_eof28: cs = 28; goto _test_eof;
_test_eof22: cs = 22; goto _test_eof;
_test_eof23: cs = 23; goto _test_eof;
+ _test_eof31: cs = 31; goto _test_eof;
_test_eof24: cs = 24; goto _test_eof;
- _test_eof29: cs = 29; goto _test_eof;
_test_eof25: cs = 25; goto _test_eof;
- _test_eof30: cs = 30; goto _test_eof;
+ _test_eof26: cs = 26; goto _test_eof;
+ _test_eof32: cs = 32; goto _test_eof;
+ _test_eof27: cs = 27; goto _test_eof;
_test_eof: {}
_out: {}
View
68 t/bugs.t
@@ -3,6 +3,8 @@
use lib 'lib';
use Test::Nginx::Socket;
+repeat_each(2);
+
plan tests => repeat_each() * 2 * blocks();
$ENV{TEST_NGINX_REDIS_PORT} ||= 6379;
@@ -11,7 +13,7 @@ $ENV{TEST_NGINX_REDIS_PORT} ||= 6379;
#worker_connections 1024;
#no_diff;
-#no_long_string;
+no_long_string;
#log_level 'warn';
@@ -19,7 +21,7 @@ run_tests();
__DATA__
-=== TEST 1: no query
+=== TEST 1: 0 in bulk size
--- config
location /set {
redis2_query set 'counters::stats::list' '[["mafiaclans.eu", 12], ["picfu.net", 5], ["www.test.com", 0], ["www.ayom.com", 0], ["www.21dezember2012.org", 0], ["the-indie.ch", 0], ["spiele-check.de", 0], ["online-right-now.net", 0], ["google.com", 0]]';
@@ -53,3 +55,65 @@ qq{+OK\r
[["mafiaclans.eu", 12], ["picfu.net", 5], ["www.test.com", 0], ["www.ayom.com", 0], ["www.21dezember2012.org", 0], ["the-indie.ch", 0], ["spiele-check.de", 0], ["online-right-now.net", 0], ["google.com", 0]]\r
}
+
+
+=== TEST 2: "0" digit in bulk count number
+--- config
+ location /set {
+ redis2_query set a hello;
+
+ redis2_pass 127.0.0.1:$TEST_NGINX_REDIS_PORT;
+ }
+
+ location /get {
+ redis2_query mget a a a a a a a a a a;
+ redis2_pass 127.0.0.1:$TEST_NGINX_REDIS_PORT;
+ }
+
+ location /main {
+ content_by_lua '
+ local res = ngx.location.capture("/set");
+ ngx.print(res.body)
+ res = ngx.location.capture("/get");
+ ngx.print(res.body)
+ ';
+ }
+--- request
+ GET /main
+--- response_body eval
+qq{+OK\r
+\*10\r
+} . "\$5\r
+hello\r
+" x 10
+
+
+
+=== TEST 3: zero bulk count
+--- config
+ location /set {
+ redis2_query flushall;
+
+ redis2_pass 127.0.0.1:$TEST_NGINX_REDIS_PORT;
+ }
+
+ location /get {
+ redis2_query lrange blah 0 0;
+ redis2_pass 127.0.0.1:$TEST_NGINX_REDIS_PORT;
+ }
+
+ location /main {
+ content_by_lua '
+ local res = ngx.location.capture("/set");
+ ngx.print(res.body)
+ res = ngx.location.capture("/get");
+ ngx.print(res.body)
+ ';
+ }
+--- request
+ GET /main
+--- response_body eval
+qq{+OK\r
+\*0\r
+}
+
View
2  t/sanity.t
@@ -3,6 +3,8 @@
use lib 'lib';
use Test::Nginx::Socket;
+repeat_each(2);
+
plan tests => repeat_each() * 2 * blocks();
$ENV{TEST_NGINX_REDIS_PORT} ||= 6379;
Please sign in to comment.
Something went wrong with that request. Please try again.