mirror of
https://github.com/nginx/nginx.git
synced 2025-08-01 02:56:15 +08:00
Xslt: xslt_last_modified directive.
Directive is similar to ssi_last_modified and sub_filter_last_modified directives introduced by previous commits.
This commit is contained in:
parent
af7e2a9185
commit
cc3c0ce870
@ -58,6 +58,7 @@ typedef struct {
|
|||||||
ngx_hash_t types;
|
ngx_hash_t types;
|
||||||
ngx_array_t *types_keys;
|
ngx_array_t *types_keys;
|
||||||
ngx_array_t *params; /* ngx_http_xslt_param_t */
|
ngx_array_t *params; /* ngx_http_xslt_param_t */
|
||||||
|
ngx_flag_t last_modified;
|
||||||
} ngx_http_xslt_filter_loc_conf_t;
|
} ngx_http_xslt_filter_loc_conf_t;
|
||||||
|
|
||||||
|
|
||||||
@ -150,6 +151,13 @@ static ngx_command_t ngx_http_xslt_filter_commands[] = {
|
|||||||
offsetof(ngx_http_xslt_filter_loc_conf_t, types_keys),
|
offsetof(ngx_http_xslt_filter_loc_conf_t, types_keys),
|
||||||
&ngx_http_xslt_default_types[0] },
|
&ngx_http_xslt_default_types[0] },
|
||||||
|
|
||||||
|
{ ngx_string("xslt_last_modified"),
|
||||||
|
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
||||||
|
ngx_conf_set_flag_slot,
|
||||||
|
NGX_HTTP_LOC_CONF_OFFSET,
|
||||||
|
offsetof(ngx_http_xslt_filter_loc_conf_t, last_modified),
|
||||||
|
NULL },
|
||||||
|
|
||||||
ngx_null_command
|
ngx_null_command
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -300,9 +308,10 @@ static ngx_int_t
|
|||||||
ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
|
ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
|
||||||
ngx_buf_t *b)
|
ngx_buf_t *b)
|
||||||
{
|
{
|
||||||
ngx_int_t rc;
|
ngx_int_t rc;
|
||||||
ngx_chain_t out;
|
ngx_chain_t out;
|
||||||
ngx_pool_cleanup_t *cln;
|
ngx_pool_cleanup_t *cln;
|
||||||
|
ngx_http_xslt_filter_loc_conf_t *conf;
|
||||||
|
|
||||||
ctx->done = 1;
|
ctx->done = 1;
|
||||||
|
|
||||||
@ -327,8 +336,13 @@ ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
|
|||||||
r->headers_out.content_length = NULL;
|
r->headers_out.content_length = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_http_clear_last_modified(r);
|
|
||||||
ngx_http_clear_etag(r);
|
ngx_http_clear_etag(r);
|
||||||
|
|
||||||
|
conf = ngx_http_get_module_loc_conf(r, ngx_http_xslt_filter_module);
|
||||||
|
|
||||||
|
if (!conf->last_modified) {
|
||||||
|
ngx_http_clear_last_modified(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ngx_http_next_header_filter(r);
|
rc = ngx_http_next_header_filter(r);
|
||||||
@ -1058,6 +1072,8 @@ ngx_http_xslt_filter_create_conf(ngx_conf_t *cf)
|
|||||||
* conf->params = NULL;
|
* conf->params = NULL;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
conf->last_modified = NGX_CONF_UNSET;
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1088,6 +1104,8 @@ ngx_http_xslt_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngx_conf_merge_value(conf->last_modified, prev->last_modified, 0);
|
||||||
|
|
||||||
return NGX_CONF_OK;
|
return NGX_CONF_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user