Mercurial > hg > nginx
comparison src/http/modules/ngx_http_xslt_filter_module.c @ 5230:2139768ee404
Xslt: xslt_last_modified directive.
Directive is similar to ssi_last_modified and sub_filter_last_modified
directives introduced by previous commits.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 24 May 2013 22:28:09 +0400 |
parents | 2570296374b4 |
children | e939f6e8548c |
comparison
equal
deleted
inserted
replaced
5229:4c1a604b0285 | 5230:2139768ee404 |
---|---|
56 xmlDtdPtr dtd; | 56 xmlDtdPtr dtd; |
57 ngx_array_t sheets; /* ngx_http_xslt_sheet_t */ | 57 ngx_array_t sheets; /* ngx_http_xslt_sheet_t */ |
58 ngx_hash_t types; | 58 ngx_hash_t types; |
59 ngx_array_t *types_keys; | 59 ngx_array_t *types_keys; |
60 ngx_array_t *params; /* ngx_http_xslt_param_t */ | 60 ngx_array_t *params; /* ngx_http_xslt_param_t */ |
61 ngx_flag_t last_modified; | |
61 } ngx_http_xslt_filter_loc_conf_t; | 62 } ngx_http_xslt_filter_loc_conf_t; |
62 | 63 |
63 | 64 |
64 typedef struct { | 65 typedef struct { |
65 xmlDocPtr doc; | 66 xmlDocPtr doc; |
148 ngx_http_types_slot, | 149 ngx_http_types_slot, |
149 NGX_HTTP_LOC_CONF_OFFSET, | 150 NGX_HTTP_LOC_CONF_OFFSET, |
150 offsetof(ngx_http_xslt_filter_loc_conf_t, types_keys), | 151 offsetof(ngx_http_xslt_filter_loc_conf_t, types_keys), |
151 &ngx_http_xslt_default_types[0] }, | 152 &ngx_http_xslt_default_types[0] }, |
152 | 153 |
154 { ngx_string("xslt_last_modified"), | |
155 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
156 ngx_conf_set_flag_slot, | |
157 NGX_HTTP_LOC_CONF_OFFSET, | |
158 offsetof(ngx_http_xslt_filter_loc_conf_t, last_modified), | |
159 NULL }, | |
160 | |
153 ngx_null_command | 161 ngx_null_command |
154 }; | 162 }; |
155 | 163 |
156 | 164 |
157 static ngx_http_module_t ngx_http_xslt_filter_module_ctx = { | 165 static ngx_http_module_t ngx_http_xslt_filter_module_ctx = { |
298 | 306 |
299 static ngx_int_t | 307 static ngx_int_t |
300 ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx, | 308 ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx, |
301 ngx_buf_t *b) | 309 ngx_buf_t *b) |
302 { | 310 { |
303 ngx_int_t rc; | 311 ngx_int_t rc; |
304 ngx_chain_t out; | 312 ngx_chain_t out; |
305 ngx_pool_cleanup_t *cln; | 313 ngx_pool_cleanup_t *cln; |
314 ngx_http_xslt_filter_loc_conf_t *conf; | |
306 | 315 |
307 ctx->done = 1; | 316 ctx->done = 1; |
308 | 317 |
309 if (b == NULL) { | 318 if (b == NULL) { |
310 return ngx_http_filter_finalize_request(r, &ngx_http_xslt_filter_module, | 319 return ngx_http_filter_finalize_request(r, &ngx_http_xslt_filter_module, |
325 if (r->headers_out.content_length) { | 334 if (r->headers_out.content_length) { |
326 r->headers_out.content_length->hash = 0; | 335 r->headers_out.content_length->hash = 0; |
327 r->headers_out.content_length = NULL; | 336 r->headers_out.content_length = NULL; |
328 } | 337 } |
329 | 338 |
330 ngx_http_clear_last_modified(r); | |
331 ngx_http_clear_etag(r); | 339 ngx_http_clear_etag(r); |
340 | |
341 conf = ngx_http_get_module_loc_conf(r, ngx_http_xslt_filter_module); | |
342 | |
343 if (!conf->last_modified) { | |
344 ngx_http_clear_last_modified(r); | |
345 } | |
332 } | 346 } |
333 | 347 |
334 rc = ngx_http_next_header_filter(r); | 348 rc = ngx_http_next_header_filter(r); |
335 | 349 |
336 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { | 350 if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { |
1056 * conf->types = { NULL }; | 1070 * conf->types = { NULL }; |
1057 * conf->types_keys = NULL; | 1071 * conf->types_keys = NULL; |
1058 * conf->params = NULL; | 1072 * conf->params = NULL; |
1059 */ | 1073 */ |
1060 | 1074 |
1075 conf->last_modified = NGX_CONF_UNSET; | |
1076 | |
1061 return conf; | 1077 return conf; |
1062 } | 1078 } |
1063 | 1079 |
1064 | 1080 |
1065 static char * | 1081 static char * |
1086 != NGX_OK) | 1102 != NGX_OK) |
1087 { | 1103 { |
1088 return NGX_CONF_ERROR; | 1104 return NGX_CONF_ERROR; |
1089 } | 1105 } |
1090 | 1106 |
1107 ngx_conf_merge_value(conf->last_modified, prev->last_modified, 0); | |
1108 | |
1091 return NGX_CONF_OK; | 1109 return NGX_CONF_OK; |
1092 } | 1110 } |
1093 | 1111 |
1094 | 1112 |
1095 static ngx_int_t | 1113 static ngx_int_t |