63 static void *ngx_http_sub_create_conf(
ngx_conf_t *cf);
64 static char *ngx_http_sub_merge_conf(
ngx_conf_t *cf,
65 void *parent,
void *child);
98 ngx_http_sub_filter_init,
106 ngx_http_sub_create_conf,
107 ngx_http_sub_merge_conf
113 &ngx_http_sub_filter_module_ctx,
114 ngx_http_sub_filter_commands,
143 return ngx_http_next_header_filter(r);
174 return ngx_http_next_header_filter(r);
190 return ngx_http_next_body_filter(r, in);
196 && ctx->
busy == NULL))
198 return ngx_http_next_body_filter(r, in);
201 if (ctx->
once && (ctx->
buf == NULL || ctx->
in == NULL)) {
204 if (ngx_http_sub_output(r, ctx) ==
NGX_ERROR) {
209 return ngx_http_next_body_filter(r, in);
221 "http sub filter \"%V\"", &r->
uri);
223 while (ctx->
in || ctx->
buf) {
225 if (ctx->
buf == NULL) {
241 "saved: \"%V\" state: %d", &ctx->
saved, ctx->
state);
243 rc = ngx_http_sub_parse(r, ctx);
246 "parse: %d, looked: \"%V\" %p-%p",
256 "saved: \"%V\"", &ctx->
saved);
281 if (b->
pos == NULL) {
429 if (ctx->
out == NULL && ctx->
busy == NULL) {
433 return ngx_http_sub_output(r, ctx);
446 for (cl = ctx->
out; cl; cl = cl->
next) {
448 "sub out: %p %p", cl->
buf, cl->
buf->
pos);
451 "the same buf was used in sub");
459 rc = ngx_http_next_body_filter(r, ctx->
out);
461 if (ctx->
busy == NULL) {
495 if (ctx->
in || ctx->
buf) {
509 u_char *p, *last, *copy_end, ch, match;
529 for (p = ctx->
pos; p < last; p++) {
581 if ((
size_t) (p - ctx->
pos) < looked) {
632 return "is duplicate";
637 ngx_strlow(value[1].data, value[1].data, value[1].len);
639 slcf->
match = value[1];
644 ccv.
value = &value[2];
683 ngx_http_sub_merge_conf(
ngx_conf_t *cf,
void *parent,
void *child)