diff options
author | Jeff Trawick <trawick@apache.org> | 2012-09-21 13:59:06 +0200 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2012-09-21 13:59:06 +0200 |
commit | 9105fe3d46b86c8e4d2251e8a11d6ac60f535d6f (patch) | |
tree | adc0a1596a26ed4c95dd85c7c73a312ba97deffc | |
parent | axe unused variable (diff) | |
download | apache2-9105fe3d46b86c8e4d2251e8a11d6ac60f535d6f.tar.xz apache2-9105fe3d46b86c8e4d2251e8a11d6ac60f535d6f.zip |
add dirwalk_stat hook, for use by mpm-itk
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1388447 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | include/ap_mmn.h | 3 | ||||
-rw-r--r-- | include/http_request.h | 9 | ||||
-rw-r--r-- | server/core.c | 9 | ||||
-rw-r--r-- | server/request.c | 16 |
5 files changed, 30 insertions, 9 deletions
@@ -1,6 +1,8 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) core: Add dirwalk_stat hook. [Jeff Trawick] + *) mod_proxy: Allow for persistence of local changes (via the balancer-manager) between graceful and normal restarts. [Jim Jagielski] diff --git a/include/ap_mmn.h b/include/ap_mmn.h index a39d86a00b..01c750f12c 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -401,6 +401,7 @@ * 20120724.1 (2.5.0-dev) Add post_perdir_config hook. * 20120724.2 (2.5.0-dev) Add fgrab slotmem function to struct * 20120724.3 (2.5.0-dev) Add bal_persist, inherit to proxy_server_conf + * 20120724.4 (2.5.0-dev) Add dirwalk_stat hook. */ #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ @@ -408,7 +409,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20120724 #endif -#define MODULE_MAGIC_NUMBER_MINOR 3 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 4 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/http_request.h b/include/http_request.h index 086e930871..1884fbef22 100644 --- a/include/http_request.h +++ b/include/http_request.h @@ -538,6 +538,15 @@ AP_DECLARE_HOOK(void,insert_filter,(request_rec *r)) */ AP_DECLARE_HOOK(int,post_perdir_config,(request_rec *r)) +/** + * This hook allows modules to handle/emulate the apr_stat() calls + * needed for directory walk. + * @param r The current request + * @return apr_status_t or AP_DECLINED (let later modules decide) + * @ingroup hooks + */ +AP_DECLARE_HOOK(apr_status_t,dirwalk_stat,(apr_finfo_t *finfo, request_rec *r, apr_int32_t wanted)) + AP_DECLARE(int) ap_location_walk(request_rec *r); AP_DECLARE(int) ap_directory_walk(request_rec *r); AP_DECLARE(int) ap_file_walk(request_rec *r); diff --git a/server/core.c b/server/core.c index 5d0e12d668..82863460b5 100644 --- a/server/core.c +++ b/server/core.c @@ -4779,6 +4779,12 @@ static apr_status_t core_insert_network_bucket(conn_rec *c, return APR_SUCCESS; } +static apr_status_t core_dirwalk_stat(apr_finfo_t *finfo, request_rec *r, + apr_int32_t wanted) +{ + return apr_stat(finfo, r->filename, wanted, r->pool); +} + static void core_dump_config(apr_pool_t *p, server_rec *s) { core_server_config *sconf = ap_get_core_module_config(s->module_config); @@ -4855,7 +4861,8 @@ static void register_hooks(apr_pool_t *p) ap_hook_child_status(ap_core_child_status, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_insert_network_bucket(core_insert_network_bucket, NULL, NULL, APR_HOOK_REALLY_LAST); - + ap_hook_dirwalk_stat(core_dirwalk_stat, NULL, NULL, APR_HOOK_REALLY_LAST); + /* register the core's insert_filter hook and register core-provided * filters */ diff --git a/server/request.c b/server/request.c index a6fb1cb11b..6e5c00a23e 100644 --- a/server/request.c +++ b/server/request.c @@ -70,6 +70,7 @@ APR_HOOK_STRUCT( APR_HOOK_LINK(insert_filter) APR_HOOK_LINK(create_request) APR_HOOK_LINK(post_perdir_config) + APR_HOOK_LINK(dirwalk_stat) ) AP_IMPLEMENT_HOOK_RUN_FIRST(int,translate_name, @@ -93,6 +94,9 @@ AP_IMPLEMENT_HOOK_RUN_ALL(int, create_request, (request_rec *r), (r), OK, DECLINED) AP_IMPLEMENT_HOOK_RUN_ALL(int, post_perdir_config, (request_rec *r), (r), OK, DECLINED) +AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t,dirwalk_stat, + (apr_finfo_t *finfo, request_rec *r, apr_int32_t wanted), + (finfo, r, wanted), AP_DECLINED) static int auth_internal_per_conf = 0; static int auth_internal_per_conf_hooks = 0; @@ -609,7 +613,7 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r) * with APR_ENOENT, knowing that the path is good. */ if (r->finfo.filetype == APR_NOFILE || r->finfo.filetype == APR_LNK) { - rv = apr_stat(&r->finfo, r->filename, APR_FINFO_MIN, r->pool); + rv = ap_run_dirwalk_stat(&r->finfo, r, APR_FINFO_MIN); /* some OSs will return APR_SUCCESS/APR_REG if we stat * a regular file but we have '/' at the end of the name; @@ -675,9 +679,8 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r) * check. */ if (!(opts & OPT_SYM_LINKS)) { - rv = apr_stat(&thisinfo, r->filename, - APR_FINFO_MIN | APR_FINFO_NAME | APR_FINFO_LINK, - r->pool); + rv = ap_run_dirwalk_stat(&thisinfo, r, + APR_FINFO_MIN | APR_FINFO_NAME | APR_FINFO_LINK); /* * APR_INCOMPLETE is as fine as result as APR_SUCCESS as we * have added APR_FINFO_NAME to the wanted parameter of @@ -1092,9 +1095,8 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r) * the name of its target, if we are fixing the filename * case/resolving aliases. */ - rv = apr_stat(&thisinfo, r->filename, - APR_FINFO_MIN | APR_FINFO_NAME | APR_FINFO_LINK, - r->pool); + rv = ap_run_dirwalk_stat(&thisinfo, r, + APR_FINFO_MIN | APR_FINFO_NAME | APR_FINFO_LINK); if (APR_STATUS_IS_ENOENT(rv)) { /* Nothing? That could be nice. But our directory |