comparison src/http/modules/ngx_http_xslt_filter_module.c @ 5280:e939f6e8548c

Xslt: exsltRegisterAll() moved to preconfiguration. The exsltRegisterAll() needs to be called before XSLT stylesheets are compiled, else stylesheet compilation hooks will not work. This change fixes EXSLT Functions extension.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 19 Jul 2013 15:59:50 +0400
parents 2139768ee404
children f1a91825730a
comparison
equal deleted inserted replaced
5267:13c006f0c40e 5280:e939f6e8548c
102 static void ngx_http_xslt_cleanup_stylesheet(void *data); 102 static void ngx_http_xslt_cleanup_stylesheet(void *data);
103 static void *ngx_http_xslt_filter_create_main_conf(ngx_conf_t *cf); 103 static void *ngx_http_xslt_filter_create_main_conf(ngx_conf_t *cf);
104 static void *ngx_http_xslt_filter_create_conf(ngx_conf_t *cf); 104 static void *ngx_http_xslt_filter_create_conf(ngx_conf_t *cf);
105 static char *ngx_http_xslt_filter_merge_conf(ngx_conf_t *cf, void *parent, 105 static char *ngx_http_xslt_filter_merge_conf(ngx_conf_t *cf, void *parent,
106 void *child); 106 void *child);
107 static ngx_int_t ngx_http_xslt_filter_preconfiguration(ngx_conf_t *cf);
107 static ngx_int_t ngx_http_xslt_filter_init(ngx_conf_t *cf); 108 static ngx_int_t ngx_http_xslt_filter_init(ngx_conf_t *cf);
108 static void ngx_http_xslt_filter_exit(ngx_cycle_t *cycle); 109 static void ngx_http_xslt_filter_exit(ngx_cycle_t *cycle);
109 110
110 111
111 ngx_str_t ngx_http_xslt_default_types[] = { 112 ngx_str_t ngx_http_xslt_default_types[] = {
161 ngx_null_command 162 ngx_null_command
162 }; 163 };
163 164
164 165
165 static ngx_http_module_t ngx_http_xslt_filter_module_ctx = { 166 static ngx_http_module_t ngx_http_xslt_filter_module_ctx = {
166 NULL, /* preconfiguration */ 167 ngx_http_xslt_filter_preconfiguration, /* preconfiguration */
167 ngx_http_xslt_filter_init, /* postconfiguration */ 168 ngx_http_xslt_filter_init, /* postconfiguration */
168 169
169 ngx_http_xslt_filter_create_main_conf, /* create main configuration */ 170 ngx_http_xslt_filter_create_main_conf, /* create main configuration */
170 NULL, /* init main configuration */ 171 NULL, /* init main configuration */
171 172
1109 return NGX_CONF_OK; 1110 return NGX_CONF_OK;
1110 } 1111 }
1111 1112
1112 1113
1113 static ngx_int_t 1114 static ngx_int_t
1114 ngx_http_xslt_filter_init(ngx_conf_t *cf) 1115 ngx_http_xslt_filter_preconfiguration(ngx_conf_t *cf)
1115 { 1116 {
1116 xmlInitParser(); 1117 xmlInitParser();
1117 1118
1118 #if (NGX_HAVE_EXSLT) 1119 #if (NGX_HAVE_EXSLT)
1119 exsltRegisterAll(); 1120 exsltRegisterAll();
1120 #endif 1121 #endif
1121 1122
1123 return NGX_OK;
1124 }
1125
1126
1127 static ngx_int_t
1128 ngx_http_xslt_filter_init(ngx_conf_t *cf)
1129 {
1122 ngx_http_next_header_filter = ngx_http_top_header_filter; 1130 ngx_http_next_header_filter = ngx_http_top_header_filter;
1123 ngx_http_top_header_filter = ngx_http_xslt_header_filter; 1131 ngx_http_top_header_filter = ngx_http_xslt_header_filter;
1124 1132
1125 ngx_http_next_body_filter = ngx_http_top_body_filter; 1133 ngx_http_next_body_filter = ngx_http_top_body_filter;
1126 ngx_http_top_body_filter = ngx_http_xslt_body_filter; 1134 ngx_http_top_body_filter = ngx_http_xslt_body_filter;