mirror of
https://github.com/nginx/nginx.git
synced 2025-07-20 19:27:29 +08:00
SSI: prevent fallback from emitting twice
This commit is contained in:
parent
9e1cd4388a
commit
b9ab9562d5
@ -2233,11 +2233,29 @@ static ngx_int_t
|
||||
ngx_http_ssi_stub_output(ngx_http_request_t *r, void *data, ngx_int_t rc)
|
||||
{
|
||||
ngx_chain_t *out;
|
||||
ngx_http_ssi_ctx_t *ctx;
|
||||
|
||||
if (rc == NGX_ERROR || r->connection->error || r->request_output) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module);
|
||||
|
||||
if (ctx && ctx->stub_output_done) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
if (ctx == NULL) {
|
||||
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_ssi_ctx_t));
|
||||
if (ctx == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ngx_http_set_ctx(r, ctx, ngx_http_ssi_filter_module);
|
||||
}
|
||||
|
||||
ctx->stub_output_done = 1;
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"ssi stub output: \"%V?%V\"", &r->uri, &r->args);
|
||||
|
||||
|
@ -82,6 +82,8 @@ typedef struct {
|
||||
void *value_buf;
|
||||
ngx_str_t timefmt;
|
||||
ngx_str_t errmsg;
|
||||
|
||||
ngx_uint_t stub_output_done;
|
||||
} ngx_http_ssi_ctx_t;
|
||||
|
||||
|
||||
|
@ -2526,7 +2526,6 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
||||
|
||||
if (r != r->main && r->post_subrequest) {
|
||||
rc = r->post_subrequest->handler(r, r->post_subrequest->data, rc);
|
||||
r->post_subrequest = NULL;
|
||||
}
|
||||
|
||||
if (rc == NGX_ERROR
|
||||
|
Loading…
Reference in New Issue
Block a user