Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_sub_filter_module.c @ 1620:54377021b936 stable-0.5
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
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 07 Nov 2007 13:59:32 +0000 |
parents | 383ae25c3171 |
children | 4b54072c0848 |
comparison
equal
deleted
inserted
replaced
1619:e2ab812358bd | 1620:54377021b936 |
---|---|
367 { | 367 { |
368 return NGX_ERROR; | 368 return NGX_ERROR; |
369 } | 369 } |
370 } | 370 } |
371 | 371 |
372 b->memory = 1; | 372 if (ctx->sub.len) { |
373 b->pos = ctx->sub.data; | 373 b->memory = 1; |
374 b->last = ctx->sub.data + ctx->sub.len; | 374 b->pos = ctx->sub.data; |
375 b->last = ctx->sub.data + ctx->sub.len; | |
376 | |
377 } else { | |
378 b->sync = 1; | |
379 } | |
375 | 380 |
376 cl->buf = b; | 381 cl->buf = b; |
377 cl->next = NULL; | 382 cl->next = NULL; |
378 *ctx->last_out = cl; | 383 *ctx->last_out = cl; |
379 ctx->last_out = &cl->next; | 384 ctx->last_out = &cl->next; |
555 | 560 |
556 ch = *p; | 561 ch = *p; |
557 ch = ngx_tolower(ch); | 562 ch = ngx_tolower(ch); |
558 } | 563 } |
559 | 564 |
565 ctx->state = state; | |
560 ctx->pos = p; | 566 ctx->pos = p; |
561 ctx->looked = looked; | 567 ctx->looked = looked; |
562 ctx->copy_end = p; | 568 ctx->copy_end = p; |
563 | 569 |
564 if (ctx->copy_start == NULL) { | 570 if (ctx->copy_start == NULL) { |
576 | 582 |
577 if (ch == ctx->match.data[looked]) { | 583 if (ch == ctx->match.data[looked]) { |
578 looked++; | 584 looked++; |
579 | 585 |
580 if (looked == ctx->match.len) { | 586 if (looked == ctx->match.len) { |
587 if ((size_t) (p - ctx->pos) < looked) { | |
588 ctx->saved = 0; | |
589 } | |
590 | |
581 ctx->state = sub_start_state; | 591 ctx->state = sub_start_state; |
582 ctx->pos = p + 1; | 592 ctx->pos = p + 1; |
583 ctx->looked = looked; | 593 ctx->looked = looked; |
584 ctx->copy_end = copy_end; | 594 ctx->copy_end = copy_end; |
585 | 595 |