diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/http/modules/ngx_http_addition_filter_module.c | 7 | ||||
| -rw-r--r-- | src/http/modules/ngx_http_ssi_filter_module.c | 20 | ||||
| -rw-r--r-- | src/http/modules/ngx_http_ssi_filter_module.h | 2 | ||||
| -rw-r--r-- | src/http/ngx_http_core_module.c | 5 | ||||
| -rw-r--r-- | src/http/ngx_http_core_module.h | 3 |
5 files changed, 26 insertions, 11 deletions
diff --git a/src/http/modules/ngx_http_addition_filter_module.c b/src/http/modules/ngx_http_addition_filter_module.c index 9db87bda9..6f15a72cc 100644 --- a/src/http/modules/ngx_http_addition_filter_module.c +++ b/src/http/modules/ngx_http_addition_filter_module.c @@ -124,6 +124,7 @@ ngx_http_addition_body_filter(ngx_http_request_t *r, ngx_chain_t *in) ngx_int_t rc; ngx_uint_t last; ngx_chain_t *cl; + ngx_http_request_t *sr; ngx_http_addition_ctx_t *ctx; ngx_http_addition_conf_t *conf; @@ -143,7 +144,7 @@ ngx_http_addition_body_filter(ngx_http_request_t *r, ngx_chain_t *in) ctx->before_body_sent = 1; if (conf->before_body.len) { - if (ngx_http_subrequest(r, &conf->before_body, NULL, NULL, 0) + if (ngx_http_subrequest(r, &conf->before_body, NULL, &sr, NULL, 0) == NGX_ERROR) { return NGX_ERROR; @@ -167,7 +168,9 @@ ngx_http_addition_body_filter(ngx_http_request_t *r, ngx_chain_t *in) return rc; } - if (ngx_http_subrequest(r, &conf->after_body, NULL, NULL, 0) == NGX_ERROR) { + if (ngx_http_subrequest(r, &conf->after_body, NULL, &sr, NULL, 0) + == NGX_ERROR) + { return NGX_ERROR; } diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c index 8faf14c72..dc0cb74fb 100644 --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -417,10 +417,11 @@ ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in) return NGX_AGAIN; } - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http ssi filter \"%V\" continue", &r->uri); - - ctx->wait = 0; + if (ctx->wait == r) { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http ssi filter \"%V\" continue", &r->uri); + ctx->wait = NULL; + } } slcf = ngx_http_get_module_loc_conf(r, ngx_http_ssi_filter_module); @@ -1814,6 +1815,7 @@ ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, ngx_buf_t *b; ngx_uint_t flags, i; ngx_chain_t *out, *cl, *tl, **ll; + ngx_http_request_t *sr; ngx_http_ssi_ctx_t *mctx; ngx_http_ssi_block_t *bl; @@ -1936,7 +1938,7 @@ ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, } } - rc = ngx_http_subrequest(r, uri, &args, out, flags); + rc = ngx_http_subrequest(r, uri, &args, &sr, out, flags); if (rc == NGX_ERROR) { return NGX_HTTP_SSI_ERROR; @@ -1947,7 +1949,13 @@ ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, } if (rc == NGX_AGAIN) { - ctx->wait = 1; + if (ctx->wait == NULL) { + ctx->wait = sr; + + } else { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "only one subrequest may be waited at the same time"); + } } return rc; diff --git a/src/http/modules/ngx_http_ssi_filter_module.h b/src/http/modules/ngx_http_ssi_filter_module.h index dc3eff064..2891969e3 100644 --- a/src/http/modules/ngx_http_ssi_filter_module.h +++ b/src/http/modules/ngx_http_ssi_filter_module.h @@ -63,8 +63,8 @@ typedef struct { unsigned block:1; unsigned output:1; unsigned output_chosen:1; - unsigned wait:1; + ngx_http_request_t *wait; void *value_buf; ngx_str_t timefmt; ngx_str_t errmsg; diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index fc24d904f..c132a2d52 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1283,7 +1283,8 @@ ngx_http_auth_basic_user(ngx_http_request_t *r) ngx_int_t ngx_http_subrequest(ngx_http_request_t *r, - ngx_str_t *uri, ngx_str_t *args, ngx_chain_t *out, ngx_uint_t flags) + ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **psr, + ngx_chain_t *out, ngx_uint_t flags) { ngx_connection_t *c; ngx_http_request_t *sr; @@ -1417,6 +1418,8 @@ ngx_http_subrequest(ngx_http_request_t *r, ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "http subrequest done \"%V?%V\"", uri, &sr->args); + *psr = sr; + if (sr->fast_subrequest) { sr->fast_subrequest = 0; diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h index 50156b1b2..f8ea3281a 100644 --- a/src/http/ngx_http_core_module.h +++ b/src/http/ngx_http_core_module.h @@ -305,7 +305,8 @@ u_char *ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *name, ngx_int_t ngx_http_auth_basic_user(ngx_http_request_t *r); ngx_int_t ngx_http_subrequest(ngx_http_request_t *r, - ngx_str_t *uri, ngx_str_t *args, ngx_chain_t *out, ngx_uint_t flags); + ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **sr, + ngx_chain_t *out, ngx_uint_t flags); ngx_int_t ngx_http_internal_redirect(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args); |
