diff options
author | Igor Sysoev <igor@sysoev.ru> | 2007-11-07 16:59:32 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2007-11-07 16:59:32 +0300 |
commit | 3a79abf0ca5dca3720f4c08eb7d91a6f9b286dc3 (patch) | |
tree | e4302f7b5ebeb15a7a79bc740bc5c62a9b3e49be /src | |
parent | 1831fb16b7fd8c45e5fb012b06a82311eeae6061 (diff) |
r1556, r1558 merge:
sub_filter fixes:
*) fix empty string replacement in sub_filter
*) 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
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_sub_filter_module.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_sub_filter_module.c b/src/http/modules/ngx_http_sub_filter_module.c index d196c1966..93d1b36ef 100644 --- a/src/http/modules/ngx_http_sub_filter_module.c +++ b/src/http/modules/ngx_http_sub_filter_module.c @@ -369,9 +369,14 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in) } } - b->memory = 1; - b->pos = ctx->sub.data; - b->last = ctx->sub.data + ctx->sub.len; + if (ctx->sub.len) { + b->memory = 1; + b->pos = ctx->sub.data; + b->last = ctx->sub.data + ctx->sub.len; + + } else { + b->sync = 1; + } cl->buf = b; cl->next = NULL; @@ -557,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; @@ -578,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; |