From: Atsushi Konno Date: Thu, 10 Mar 2011 09:58:07 +0000 (+0900) Subject: * Added feature. X-Git-Tag: v0.13.1~17 X-Git-Url: http://git.osdn.net/view?p=modchxj%2Fmod_chxj.git;a=commitdiff_plain;h=3f610d307d3a951d98bfef4266a80ee281e9b4ce * Added feature. - remove output_filter if it is not necessary. - remove chxj_specified_cleanup. --- diff --git a/include/mod_chxj.h b/include/mod_chxj.h index 381ee3c8..a5966b18 100755 --- a/include/mod_chxj.h +++ b/include/mod_chxj.h @@ -382,6 +382,7 @@ struct mod_chxj_config { struct mod_chxj_req_config_t { char *user_agent; device_table *spec; + ap_filter_t *f; }; #define IS_COOKIE_STORE_DBM(X) ((X) == COOKIE_STORE_TYPE_DBM) @@ -536,6 +537,7 @@ extern char *chxj_node_convert_chxjif_only( const char *src, apr_size_t *len ); +extern void chxj_remove_filter(request_rec *r); #define IMAGE_CACHE_LIMIT_FMT_LEN (20) diff --git a/src/chxj_img_conv_format.c b/src/chxj_img_conv_format.c index c6ffaa96..63bd9e51 100644 --- a/src/chxj_img_conv_format.c +++ b/src/chxj_img_conv_format.c @@ -320,6 +320,10 @@ chxj_img_conv_format_handler(request_rec *r) DBG(r,"REQ[%X] User-Agent=[%s]", TO_ADDR(r), user_agent); + /*-------------------------------------------------------------------------*/ + /* Do not process output_filter */ + /*-------------------------------------------------------------------------*/ + chxj_remove_filter(r); rtn = s_img_conv_format_from_file(r, conf, user_agent, qsp, spec); DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__); return rtn; diff --git a/src/mod_chxj.c b/src/mod_chxj.c index 43535345..5e6b7adf 100644 --- a/src/mod_chxj.c +++ b/src/mod_chxj.c @@ -194,6 +194,7 @@ chxj_headers_fixup(request_rec *r) request_conf = apr_palloc(r->pool, sizeof(mod_chxj_req_config)); request_conf->spec = NULL; request_conf->user_agent = NULL; + request_conf->f = NULL; chxj_set_module_config(r->request_config, &chxj_module, request_conf); } dconf = chxj_get_module_config(r->per_dir_config, &chxj_module); @@ -1718,6 +1719,7 @@ chxj_insert_filter(request_rec *r) char *user_agent; device_table *spec; mod_chxj_config *dconf; + mod_chxj_req_config *req_conf; chxjconvrule_entry *entryp; mod_chxj_ctx *ctx; apr_status_t rv; @@ -1726,6 +1728,7 @@ chxj_insert_filter(request_rec *r) DBG(r, "REQ[%X] start %s()", TO_ADDR(r),__func__); dconf = chxj_get_module_config(r->per_dir_config, &chxj_module); + req_conf = chxj_get_module_config(r->request_config, &chxj_module); /* we get User-Agent from CHXJ_HTTP_USER_AGENT header if any */ user_agent = (char *)apr_table_get(r->headers_in, CHXJ_HTTP_USER_AGENT); @@ -1786,7 +1789,7 @@ chxj_insert_filter(request_rec *r) if (! apr_table_get(r->headers_in, "X-Chxj-Forward")) { - ap_add_output_filter("chxj_output_filter", ctx, r, r->connection); + req_conf->f = ap_add_output_filter("chxj_output_filter", ctx, r, r->connection); DBG(r, "REQ[%X] added Output Filter", TO_ADDR(r)); } @@ -1794,6 +1797,21 @@ chxj_insert_filter(request_rec *r) } +void +chxj_remove_filter(request_rec *r) +{ + mod_chxj_req_config *req_conf; + + DBG(r, "REQ[%X] start %s()", TO_ADDR(r),__func__); + req_conf = chxj_get_module_config(r->request_config, &chxj_module); + if (req_conf && req_conf->f) { + ap_remove_output_filter(req_conf->f); + DBG(r, "REQ[%X] REMOVE Output Filter", TO_ADDR(r)); + } + DBG(r, "REQ[%X] end %s()", TO_ADDR(r),__func__); +} + + /** * The hook is registered. *