]> git.kaiwu.me - nginx.git/commitdiff
*) add sub_filter parser fix similar to r1261 in SSI parser
authorIgor Sysoev <igor@sysoev.ru>
Tue, 2 Oct 2007 18:53:31 +0000 (18:53 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 2 Oct 2007 18:53:31 +0000 (18:53 +0000)
*) fix case when pattern is split between two buffers:
   it had been fixed in SSI parser long ago

src/http/modules/ngx_http_sub_filter_module.c

index a9fe8d40706c88135adea4b26d2e5fca16fdd5b1..93d1b36ef8e3e9d3a3efddeab7f4d0653f1bd1c7 100644 (file)
@@ -562,6 +562,7 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
                 ch = ngx_tolower(ch);
             }
 
+            ctx->state = state;
             ctx->pos = p;
             ctx->looked = looked;
             ctx->copy_end = p;
@@ -583,6 +584,10 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
             looked++;
 
             if (looked == ctx->match.len) {
+                if ((size_t) (p - ctx->pos) < looked) {
+                    ctx->saved = 0;
+                }
+
                 ctx->state = sub_start_state;
                 ctx->pos = p + 1;
                 ctx->looked = looked;