changeset 1557:9d094e581587

*) add sub_filter parser fix similar to r1261 in SSI parser *) fix case when pattern is split between two buffers: it had been fixed in SSI parser long ago
author Igor Sysoev <igor@sysoev.ru>
date Tue, 02 Oct 2007 18:53:31 +0000
parents 3dc408adbb70
children 6d6c5ddedfc0
files src/http/modules/ngx_http_sub_filter_module.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_sub_filter_module.c
+++ b/src/http/modules/ngx_http_sub_filter_module.c
@@ -562,6 +562,7 @@ ngx_http_sub_parse(ngx_http_request_t *r
                 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
             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;