From 54a1ac75c78739ac68f808b5709eae7f42c7740b Mon Sep 17 00:00:00 2001 From: Justin Erenkrantz Date: Thu, 7 Mar 2002 09:27:17 +0000 Subject: [PATCH] As hinted on dev@httpd, change filter naming schemes to match our expectations of their usage. The reason that we should make this change now is that we have changed the implied meaning of AP_FTYPE_HTTP_HEADER - some users of this should be PROTOCOL while others should be CONTENT_SET. In order to clarify it, toss all of the bogus names and force the filter writers to make sure they understand what they are doing. CONTENT_SET is new (horrible name - change if you have better idea), but it indicates that it should run between RESOURCE and PROTOCOL. mod_deflate is the ideal CONTENT_SET filter. The changed type names are: CONTENT is now RESOURCE. HTTP_HEADER is now PROTOCOL. However, most filters that used HTTP_HEADER may want CONTENT_SET. (Only things like POP and HTTP belong as PROTOCOL.) MMN bump since all filters need to be recompiled due to filter reordering. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93756 13f79535-47bb-0310-9956-ffa450edef68 --- include/ap_mmn.h | 3 ++- include/util_filter.h | 25 ++++++++++++--------- modules/experimental/mod_cache.c | 6 ++--- modules/experimental/mod_case_filter.c | 2 +- modules/experimental/mod_case_filter_in.c | 2 +- modules/experimental/mod_charset_lite.c | 4 ++-- modules/experimental/mod_deflate.c | 2 +- modules/experimental/mod_ext_filter.c | 4 ++-- modules/filters/mod_include.c | 2 +- modules/http/http_core.c | 6 ++--- modules/metadata/mod_headers.c | 2 +- modules/proxy/proxy_ftp.c | 2 +- modules/test/mod_bucketeer.c | 2 +- server/core.c | 10 ++++----- server/mpm/experimental/perchild/perchild.c | 2 +- server/mpm/perchild/perchild.c | 2 +- server/util_filter.c | 2 +- 17 files changed, 41 insertions(+), 37 deletions(-) diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 071d3392f2..9d17825e39 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -98,12 +98,13 @@ * 20020218 (2.0.33-dev) bump for AddOutputFilterByType directive * 20020220 (2.0.33-dev) bump for scoreboard.h structure change * 20020302 (2.0.33-dev) bump for protocol_filter additions. + * 20020306 (2.0.34-dev) bump for filter type renames. */ #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 20020302 +#define MODULE_MAGIC_NUMBER_MAJOR 20020306 #endif #define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR /* backward compat */ diff --git a/include/util_filter.h b/include/util_filter.h index 19d845afb9..8a66a47227 100644 --- a/include/util_filter.h +++ b/include/util_filter.h @@ -185,26 +185,29 @@ typedef union ap_filter_func { typedef enum { /** These filters are used to alter the content that is passed through * them. Examples are SSI or PHP. */ - AP_FTYPE_CONTENT = 10, - /** (XXX somebody rename me or get rid of me please) - * This special type ensures that the HTTP header filter ends up in - * the proper location in the filter chain. */ - AP_FTYPE_HTTP_HEADER = 20, + AP_FTYPE_RESOURCE = 10, + /** These filters are used to alter the content as a whole, but after all + * AP_FTYPE_RESOURCE filters are executed. These filters should not + * change the content-type. An example is deflate. */ + AP_FTYPE_CONTENT_SET = 20, + /** These filters are used to handle the protocol between server and + * client. Examples are HTTP and POP. */ + AP_FTYPE_PROTOCOL = 30, /** These filters implement transport encodings (e.g., chunking). */ - AP_FTYPE_TRANSCODE = 30, + AP_FTYPE_TRANSCODE = 40, /** These filters will alter the content, but in ways that are * more strongly associated with the connection. Examples are - * splitting * an HTTP connection into multiple requests and - * buffering HTTP * responses across multiple requests. + * splitting an HTTP connection into multiple requests and + * buffering HTTP responses across multiple requests. * * It is important to note that these types of filters are not * allowed in a sub-request. A sub-request's output can certainly - * be filtered by ::AP_FTYPE_CONTENT filters, but all of the "final + * be filtered by ::AP_FTYPE_RESOURCE filters, but all of the "final * processing" is determined by the main request. */ - AP_FTYPE_CONNECTION = 40, + AP_FTYPE_CONNECTION = 50, /** These filters don't alter the content. They are responsible for * sending/receiving data to/from the client. */ - AP_FTYPE_NETWORK = 50 + AP_FTYPE_NETWORK = 60 } ap_filter_type; /** diff --git a/modules/experimental/mod_cache.c b/modules/experimental/mod_cache.c index c72b15d531..86c52aca09 100644 --- a/modules/experimental/mod_cache.c +++ b/modules/experimental/mod_cache.c @@ -998,13 +998,13 @@ register_hooks(apr_pool_t *p) */ ap_register_output_filter("CACHE_IN", cache_in_filter, - AP_FTYPE_CONTENT+1); + AP_FTYPE_CONTENT_SET); ap_register_output_filter("CACHE_OUT", cache_out_filter, - AP_FTYPE_CONTENT+1); + AP_FTYPE_CONTENT_SET); ap_register_output_filter("CACHE_CONDITIONAL", cache_conditional_filter, - AP_FTYPE_CONTENT+1); + AP_FTYPE_CONTENT_SET); ap_hook_post_config(cache_post_config, NULL, NULL, APR_HOOK_REALLY_FIRST); } diff --git a/modules/experimental/mod_case_filter.c b/modules/experimental/mod_case_filter.c index 95515d7298..ae0209d832 100644 --- a/modules/experimental/mod_case_filter.c +++ b/modules/experimental/mod_case_filter.c @@ -100,7 +100,7 @@ static void CaseFilterRegisterHooks(apr_pool_t *p) { ap_hook_insert_filter(CaseFilterInsertFilter,NULL,NULL,APR_HOOK_MIDDLE); ap_register_output_filter(s_szCaseFilterName,CaseFilterOutFilter, - AP_FTYPE_CONTENT); + AP_FTYPE_RESOURCE); } module AP_MODULE_DECLARE_DATA case_filter_module = diff --git a/modules/experimental/mod_case_filter_in.c b/modules/experimental/mod_case_filter_in.c index 18b44dd721..d907573a85 100644 --- a/modules/experimental/mod_case_filter_in.c +++ b/modules/experimental/mod_case_filter_in.c @@ -181,7 +181,7 @@ static void CaseFilterInRegisterHooks(apr_pool_t *p) ap_hook_insert_filter(CaseFilterInInsertFilter, NULL, NULL, APR_HOOK_MIDDLE); ap_register_input_filter(s_szCaseFilterName, CaseFilterInFilter, - AP_FTYPE_CONTENT); + AP_FTYPE_RESOURCE); } module AP_MODULE_DECLARE_DATA case_filter_in_module = diff --git a/modules/experimental/mod_charset_lite.c b/modules/experimental/mod_charset_lite.c index cdc48296af..218574a100 100644 --- a/modules/experimental/mod_charset_lite.c +++ b/modules/experimental/mod_charset_lite.c @@ -1100,9 +1100,9 @@ static void charset_register_hooks(apr_pool_t *p) ap_hook_fixups(find_code_page, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_insert_filter(xlate_insert_filter, NULL, NULL, APR_HOOK_REALLY_LAST); ap_register_output_filter(XLATEOUT_FILTER_NAME, xlate_out_filter, - AP_FTYPE_CONTENT); + AP_FTYPE_RESOURCE); ap_register_input_filter(XLATEIN_FILTER_NAME, xlate_in_filter, - AP_FTYPE_CONTENT); + AP_FTYPE_RESOURCE); } module AP_MODULE_DECLARE_DATA charset_lite_module = diff --git a/modules/experimental/mod_deflate.c b/modules/experimental/mod_deflate.c index 2e4b15b86a..33e8e23515 100644 --- a/modules/experimental/mod_deflate.c +++ b/modules/experimental/mod_deflate.c @@ -445,7 +445,7 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, static void register_hooks(apr_pool_t * p) { ap_register_output_filter(deflateFilterName, deflate_out_filter, - AP_FTYPE_HTTP_HEADER); + AP_FTYPE_CONTENT_SET); } static const command_rec deflate_filter_cmds[] = { diff --git a/modules/experimental/mod_ext_filter.c b/modules/experimental/mod_ext_filter.c index ba5444bb31..5f0ee7aeb7 100644 --- a/modules/experimental/mod_ext_filter.c +++ b/modules/experimental/mod_ext_filter.c @@ -310,12 +310,12 @@ static const char *define_filter(cmd_parms *cmd, void *dummy, const char *args) */ if (filter->mode == OUTPUT_FILTER) { /* XXX need a way to ensure uniqueness among all filters */ - ap_register_output_filter(filter->name, ef_output_filter, AP_FTYPE_CONTENT); + ap_register_output_filter(filter->name, ef_output_filter, AP_FTYPE_RESOURCE); } #if 0 /* no input filters yet */ else if (filter->mode == INPUT_FILTER) { /* XXX need a way to ensure uniqueness among all filters */ - ap_register_input_filter(filter->name, ef_input_filter, AP_FTYPE_CONTENT); + ap_register_input_filter(filter->name, ef_input_filter, AP_FTYPE_RESOURCE); } #endif else { diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 6088060164..0416073d1b 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -3457,7 +3457,7 @@ static void register_hooks(apr_pool_t *p) APR_REGISTER_OPTIONAL_FN(ap_register_include_handler); ap_hook_post_config(include_post_config, NULL, NULL, APR_HOOK_REALLY_FIRST); ap_hook_fixups(include_fixup, NULL, NULL, APR_HOOK_LAST); - ap_register_output_filter("INCLUDES", includes_filter, AP_FTYPE_CONTENT); + ap_register_output_filter("INCLUDES", includes_filter, AP_FTYPE_RESOURCE); } module AP_MODULE_DECLARE_DATA include_module = diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 26e50935b6..2d36387a3a 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -326,15 +326,15 @@ static void register_hooks(apr_pool_t *p) ap_hook_create_request(http_create_request, NULL, NULL, APR_HOOK_REALLY_LAST); ap_http_input_filter_handle = ap_register_input_filter("HTTP_IN", ap_http_filter, - AP_FTYPE_HTTP_HEADER); + AP_FTYPE_PROTOCOL); ap_http_header_filter_handle = ap_register_output_filter("HTTP_HEADER", ap_http_header_filter, - AP_FTYPE_HTTP_HEADER); + AP_FTYPE_PROTOCOL); ap_chunk_filter_handle = ap_register_output_filter("CHUNK", chunk_filter, AP_FTYPE_TRANSCODE); ap_byterange_filter_handle = ap_register_output_filter("BYTERANGE", ap_byterange_filter, - AP_FTYPE_HTTP_HEADER); + AP_FTYPE_PROTOCOL); } module AP_MODULE_DECLARE_DATA http_module = { diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c index 2e06ad52a6..258b831be7 100644 --- a/modules/metadata/mod_headers.c +++ b/modules/metadata/mod_headers.c @@ -620,7 +620,7 @@ static void register_hooks(apr_pool_t *p) ap_hook_pre_config(header_pre_config,NULL,NULL,APR_HOOK_MIDDLE); ap_hook_insert_filter(ap_headers_insert_output_filter, NULL, NULL, APR_HOOK_LAST); ap_hook_fixups(ap_headers_fixup, NULL, NULL, APR_HOOK_LAST); - ap_register_output_filter("FIXUP_HEADERS_OUT", ap_headers_output_filter, AP_FTYPE_HTTP_HEADER); + ap_register_output_filter("FIXUP_HEADERS_OUT", ap_headers_output_filter, AP_FTYPE_CONTENT_SET); } module AP_MODULE_DECLARE_DATA headers_module = diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c index 33faf65aa7..d8d5380246 100644 --- a/modules/proxy/proxy_ftp.c +++ b/modules/proxy/proxy_ftp.c @@ -1859,7 +1859,7 @@ static void ap_proxy_ftp_register_hook(apr_pool_t *p) proxy_hook_scheme_handler(ap_proxy_ftp_handler, NULL, NULL, APR_HOOK_MIDDLE); proxy_hook_canon_handler(ap_proxy_ftp_canon, NULL, NULL, APR_HOOK_MIDDLE); /* filters */ - ap_register_output_filter("PROXY_SEND_DIR", ap_proxy_send_dir_filter, AP_FTYPE_CONTENT); + ap_register_output_filter("PROXY_SEND_DIR", ap_proxy_send_dir_filter, AP_FTYPE_RESOURCE); } module AP_MODULE_DECLARE_DATA proxy_ftp_module = { diff --git a/modules/test/mod_bucketeer.c b/modules/test/mod_bucketeer.c index 2f19de88b7..bd33b4b4ca 100644 --- a/modules/test/mod_bucketeer.c +++ b/modules/test/mod_bucketeer.c @@ -194,7 +194,7 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f, static void register_hooks(apr_pool_t * p) { ap_register_output_filter(bucketeerFilterName, bucketeer_out_filter, - AP_FTYPE_CONTENT-1); + AP_FTYPE_RESOURCE-1); } static const command_rec bucketeer_filter_cmds[] = { diff --git a/server/core.c b/server/core.c index 3c708d9b1c..3eca23ddd6 100644 --- a/server/core.c +++ b/server/core.c @@ -3141,7 +3141,7 @@ static int default_handler(request_rec *r) d = (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module); bld_content_md5 = (d->content_md5 & 1) - && r->output_filters->frec->ftype != AP_FTYPE_CONTENT; + && r->output_filters->frec->ftype != AP_FTYPE_RESOURCE; ap_allow_standard_methods(r, MERGE_ALLOW, M_GET, M_OPTIONS, M_POST, -1); @@ -4031,18 +4031,18 @@ static void register_hooks(apr_pool_t *p) AP_FTYPE_NETWORK); ap_net_time_filter_handle = ap_register_input_filter("NET_TIME", net_time_filter, - AP_FTYPE_HTTP_HEADER); + AP_FTYPE_PROTOCOL); ap_content_length_filter_handle = ap_register_output_filter("CONTENT_LENGTH", ap_content_length_filter, - AP_FTYPE_HTTP_HEADER); + AP_FTYPE_PROTOCOL); ap_core_output_filter_handle = ap_register_output_filter("CORE", core_output_filter, AP_FTYPE_NETWORK); ap_subreq_core_filter_handle = ap_register_output_filter("SUBREQ_CORE", ap_sub_req_output_filter, - AP_FTYPE_CONTENT + 5); + AP_FTYPE_CONTENT_SET); ap_old_write_func = ap_register_output_filter("OLD_WRITE", - ap_old_write_filter, AP_FTYPE_CONTENT - 10); + ap_old_write_filter, AP_FTYPE_RESOURCE - 10); } AP_DECLARE_DATA module core_module = { diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index a92cc0ddee..0181d87ef0 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -1754,7 +1754,7 @@ static void perchild_hooks(apr_pool_t *p) ap_hook_post_read_request(perchild_post_read, NULL, NULL, APR_HOOK_REALLY_FIRST); ap_register_input_filter("PERCHILD_BUFFER", perchild_buffer, - AP_FTYPE_CONTENT); + AP_FTYPE_RESOURCE); } static const char *set_num_daemons(cmd_parms *cmd, void *dummy, diff --git a/server/mpm/perchild/perchild.c b/server/mpm/perchild/perchild.c index a92cc0ddee..0181d87ef0 100644 --- a/server/mpm/perchild/perchild.c +++ b/server/mpm/perchild/perchild.c @@ -1754,7 +1754,7 @@ static void perchild_hooks(apr_pool_t *p) ap_hook_post_read_request(perchild_post_read, NULL, NULL, APR_HOOK_REALLY_FIRST); ap_register_input_filter("PERCHILD_BUFFER", perchild_buffer, - AP_FTYPE_CONTENT); + AP_FTYPE_RESOURCE); } static const char *set_num_daemons(cmd_parms *cmd, void *dummy, diff --git a/server/util_filter.c b/server/util_filter.c index 5d597c37ca..88b62ee145 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -301,7 +301,7 @@ static ap_filter_t *add_any_filter_handle(ap_filter_rec_t *frec, void *ctx, ap_filter_t *f = apr_palloc(p, sizeof(*f)); ap_filter_t **outf; - if (frec->ftype < AP_FTYPE_HTTP_HEADER) { + if (frec->ftype < AP_FTYPE_PROTOCOL) { if (r) { outf = r_filters; } -- 2.40.0