From: William A. Rowe Jr Date: Sat, 7 Jun 2008 00:59:04 +0000 (+0000) Subject: You don't export the local registered functions X-Git-Tag: 2.3.0~526 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acd6d4f502e9f7cb16020b89ebd7b46cbb2b538b;p=apache You don't export the local registered functions when using optional fn's and hooks. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@664224 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/session/mod_session.c b/modules/session/mod_session.c index c9450b8a8c..1559ee5bfe 100644 --- a/modules/session/mod_session.c +++ b/modules/session/mod_session.c @@ -32,13 +32,13 @@ APR_HOOK_STRUCT( APR_HOOK_LINK(session_encode) APR_HOOK_LINK(session_decode) ) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(session, SESSION, int, session_load, +APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap, SESSION, int, session_load, (request_rec * r, session_rec ** z), (r, z), DECLINED) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(session, SESSION, int, session_save, +APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap, SESSION, int, session_save, (request_rec * r, session_rec * z), (r, z), DECLINED) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(session, SESSION, int, session_encode, +APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap, SESSION, int, session_encode, (request_rec * r, session_rec * z), (r, z), OK, DECLINED) -APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(session, SESSION, int, session_decode, +APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap, SESSION, int, session_decode, (request_rec * r, session_rec * z), (r, z), OK, DECLINED) static int session_identity_encode(request_rec * r, session_rec * z); @@ -81,54 +81,6 @@ static int session_included(request_rec * r, session_dir_conf * conf) return included; } -/** - * Get a particular value from the session. - * @param r The current request. - * @param z The current session. If this value is NULL, the session will be - * looked up in the request, created if necessary, and saved to the request - * notes. - * @param key The key to get. - * @param value The buffer to write the value to. - */ -SESSION_DECLARE(void) ap_session_get(request_rec * r, session_rec * z, const char *key, const char **value) -{ - if (!z) { - ap_session_load(r, &z); - } - if (z && z->entries) { - *value = apr_table_get(z->entries, key); - } -} - -/** - * Set a particular value to the session. - * - * Using this method ensures that the dirty flag is set correctly, so that - * the session can be saved efficiently. - * @param r The current request. - * @param z The current session. If this value is NULL, the session will be - * looked up in the request, created if necessary, and saved to the request - * notes. - * @param key The key to set. The existing key value will be replaced. - * @param value The value to set. - */ -SESSION_DECLARE(void) ap_session_set(request_rec * r, session_rec * z, - const char *key, const char *value) -{ - if (!z) { - ap_session_load(r, &z); - } - if (z) { - if (value) { - apr_table_set(z->entries, key, value); - } - else { - apr_table_unset(z->entries, key); - } - z->dirty = 1; - } -} - /** * Load the session. * @@ -137,7 +89,7 @@ SESSION_DECLARE(void) ap_session_set(request_rec * r, session_rec * z, * @param r The request * @param z A pointer to where the session will be written. */ -SESSION_DECLARE(int) ap_session_load(request_rec * r, session_rec ** z) +static int ap_session_load(request_rec * r, session_rec ** z) { session_dir_conf *dconf = ap_get_module_config(r->per_dir_config, @@ -216,7 +168,7 @@ SESSION_DECLARE(int) ap_session_load(request_rec * r, session_rec ** z) * @param r The request * @param z A pointer to where the session will be written. */ -SESSION_DECLARE(int) ap_session_save(request_rec * r, session_rec * z) +static int ap_session_save(request_rec * r, session_rec * z) { if (z) { apr_time_t now = apr_time_now(); @@ -268,6 +220,54 @@ SESSION_DECLARE(int) ap_session_save(request_rec * r, session_rec * z) } +/** + * Get a particular value from the session. + * @param r The current request. + * @param z The current session. If this value is NULL, the session will be + * looked up in the request, created if necessary, and saved to the request + * notes. + * @param key The key to get. + * @param value The buffer to write the value to. + */ +static void ap_session_get(request_rec * r, session_rec * z, const char *key, const char **value) +{ + if (!z) { + ap_session_load(r, &z); + } + if (z && z->entries) { + *value = apr_table_get(z->entries, key); + } +} + +/** + * Set a particular value to the session. + * + * Using this method ensures that the dirty flag is set correctly, so that + * the session can be saved efficiently. + * @param r The current request. + * @param z The current session. If this value is NULL, the session will be + * looked up in the request, created if necessary, and saved to the request + * notes. + * @param key The key to set. The existing key value will be replaced. + * @param value The value to set. + */ +static void ap_session_set(request_rec * r, session_rec * z, + const char *key, const char *value) +{ + if (!z) { + ap_session_load(r, &z); + } + if (z) { + if (value) { + apr_table_set(z->entries, key, value); + } + else { + apr_table_unset(z->entries, key); + } + z->dirty = 1; + } +} + static int identity_count(int *count, const char *key, const char *val) { *count += strlen(key) * 3 + strlen(val) * 3 + 1; @@ -396,7 +396,7 @@ static int session_identity_decode(request_rec * r, session_rec * z) * The same session might appear in more than one request. The first * attempt to save the session will be called */ -static apr_status_t ap_session_output_filter(ap_filter_t * f, +static apr_status_t session_output_filter(ap_filter_t * f, apr_bucket_brigade * in) { @@ -446,7 +446,7 @@ static apr_status_t ap_session_output_filter(ap_filter_t * f, /** * Insert the output filter. */ -static void ap_session_insert_output_filter(request_rec * r) +static void session_insert_output_filter(request_rec * r) { ap_add_output_filter("MOD_SESSION_OUT", NULL, r, r->connection); } @@ -599,14 +599,17 @@ static const command_rec session_cmds[] = static void register_hooks(apr_pool_t * p) { - ap_register_output_filter("MOD_SESSION_OUT", ap_session_output_filter, + ap_register_output_filter("MOD_SESSION_OUT", session_output_filter, NULL, AP_FTYPE_CONTENT_SET); - ap_hook_insert_filter(ap_session_insert_output_filter, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_insert_error_filter(ap_session_insert_output_filter, + ap_hook_insert_filter(session_insert_output_filter, NULL, NULL, + APR_HOOK_MIDDLE); + ap_hook_insert_error_filter(session_insert_output_filter, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_fixups(session_fixups, NULL, NULL, APR_HOOK_MIDDLE); - ap_hook_session_encode(session_identity_encode, NULL, NULL, APR_HOOK_REALLY_FIRST); - ap_hook_session_decode(session_identity_decode, NULL, NULL, APR_HOOK_REALLY_LAST); + ap_hook_session_encode(session_identity_encode, NULL, NULL, + APR_HOOK_REALLY_FIRST); + ap_hook_session_decode(session_identity_decode, NULL, NULL, + APR_HOOK_REALLY_LAST); APR_REGISTER_OPTIONAL_FN(ap_session_get); APR_REGISTER_OPTIONAL_FN(ap_session_set); APR_REGISTER_OPTIONAL_FN(ap_session_load); diff --git a/modules/session/mod_session.h b/modules/session/mod_session.h index 6d816398c5..0809cff53f 100644 --- a/modules/session/mod_session.h +++ b/modules/session/mod_session.h @@ -117,42 +117,6 @@ typedef struct { * URLs excluded if empty */ } session_dir_conf; -/** - * Get a particular value from the session. - * @param r The current request. - * @param z The current session. If this value is NULL, the session will be - * looked up in the request, created if necessary, and saved to the request - * notes. - * @param key The key to get. - * @param value The buffer to write the value to. - */ -SESSION_DECLARE(void) ap_session_get(request_rec * r, session_rec * z, const char *key, const char **value); - -/** - * Set a particular value to the session. - * - * Using this method ensures that the dirty flag is set correctly, so that - * the session can be saved efficiently. - * @param r The current request. - * @param z The current session. If this value is NULL, the session will be - * looked up in the request, created if necessary, and saved to the request - * notes. - * @param key The key to set. The existing key value will be replaced. - * @param value The value to set. - */ -SESSION_DECLARE(void) ap_session_set(request_rec * r, session_rec * z, - const char *key, const char *value); - -/** - * Load the session. - * - * If the session doesn't exist, a blank one will be created. - * - * @param r The request - * @param z A pointer to where the session will be written. - */ -SESSION_DECLARE(int) ap_session_load(request_rec * r, session_rec ** z); - /** * Hook to load the session. * @@ -161,20 +125,9 @@ SESSION_DECLARE(int) ap_session_load(request_rec * r, session_rec ** z); * @param r The request * @param z A pointer to where the session will be written. */ -APR_DECLARE_EXTERNAL_HOOK(session, SESSION, int, session_load, +APR_DECLARE_EXTERNAL_HOOK(ap, SESSION, int, session_load, (request_rec * r, session_rec ** z)) -/** - * Save the session. - * - * In most implementations the session is only saved if the dirty flag is - * true. This prevents the session being saved unnecessarily. - * - * @param r The request - * @param z A pointer to where the session will be written. - */ -SESSION_DECLARE(int) ap_session_save(request_rec * r, session_rec * z); - /** * Hook to save the session. * @@ -184,7 +137,7 @@ SESSION_DECLARE(int) ap_session_save(request_rec * r, session_rec * z); * @param r The request * @param z A pointer to where the session will be written. */ -APR_DECLARE_EXTERNAL_HOOK(session, SESSION, int, session_save, +APR_DECLARE_EXTERNAL_HOOK(ap, SESSION, int, session_save, (request_rec * r, session_rec * z)) /** @@ -197,7 +150,7 @@ APR_DECLARE_EXTERNAL_HOOK(session, SESSION, int, session_save, * @param r The request * @param z A pointer to where the session will be written. */ -APR_DECLARE_EXTERNAL_HOOK(session, SESSION, int, session_encode, +APR_DECLARE_EXTERNAL_HOOK(ap, SESSION, int, session_encode, (request_rec * r, session_rec * z)) /** @@ -210,7 +163,7 @@ APR_DECLARE_EXTERNAL_HOOK(session, SESSION, int, session_encode, * @param r The request * @param z A pointer to where the session will be written. */ -APR_DECLARE_EXTERNAL_HOOK(session, SESSION, int, session_decode, +APR_DECLARE_EXTERNAL_HOOK(ap, SESSION, int, session_decode, (request_rec * r, session_rec * z)) APR_DECLARE_OPTIONAL_FN(void, ap_session_get, (request_rec * r, session_rec * z,