summaryrefslogtreecommitdiffstats
path: root/modules/metadata
diff options
context:
space:
mode:
authorChristophe Jaillet <jailletc36@apache.org>2020-02-28 07:13:50 +0100
committerChristophe Jaillet <jailletc36@apache.org>2020-02-28 07:13:50 +0100
commita7c32365ec80346677b14657de8203779a2948b0 (patch)
tree7f8347df29638c9fecb94c6b39de4b07b7fb1f02 /modules/metadata
parentRemove duplicated "CookieTracking" directive in 'command_rec'. (diff)
downloadapache2-a7c32365ec80346677b14657de8203779a2948b0.tar.xz
apache2-a7c32365ec80346677b14657de8203779a2948b0.zip
Slighly simplify code.
No need to set to NULL or 0 fields that are apr_pcalloc'ed. Axe 'set_cookie_enable' and use 'ap_set_flag_slot' instead. (based on ideas taken from r1874389) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874602 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/metadata')
-rw-r--r--modules/metadata/mod_usertrack.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/modules/metadata/mod_usertrack.c b/modules/metadata/mod_usertrack.c
index 8ddff6624f..fc022fac97 100644
--- a/modules/metadata/mod_usertrack.c
+++ b/modules/metadata/mod_usertrack.c
@@ -284,10 +284,9 @@ static void *make_cookie_dir(apr_pool_t *p, char *d)
dcfg = (cookie_dir_rec *) apr_pcalloc(p, sizeof(cookie_dir_rec));
dcfg->cookie_name = COOKIE_NAME;
- dcfg->cookie_domain = NULL;
dcfg->style = CT_UNSET;
- dcfg->enabled = 0;
- /* calloc'ed to disabled: samesite, is_secure, is_httponly */
+ /* calloc'ed to disabled: enabled, cookie_domain, samesite, is_secure,
+ * is_httponly */
/* In case the user does not use the CookieName directive,
* we need to compile the regexp for the default cookie name. */
@@ -296,14 +295,6 @@ static void *make_cookie_dir(apr_pool_t *p, char *d)
return dcfg;
}
-static const char *set_cookie_enable(cmd_parms *cmd, void *mconfig, int arg)
-{
- cookie_dir_rec *dcfg = mconfig;
-
- dcfg->enabled = arg;
- return NULL;
-}
-
static const char *set_cookie_exp(cmd_parms *parms, void *dummy,
const char *arg)
{
@@ -479,7 +470,8 @@ static const command_rec cookie_log_cmds[] = {
"domain to which this cookie applies"),
AP_INIT_TAKE1("CookieStyle", set_cookie_style, NULL, OR_FILEINFO,
"'Netscape', 'Cookie' (RFC2109), or 'Cookie2' (RFC2965)"),
- AP_INIT_FLAG("CookieTracking", set_cookie_enable, NULL, OR_FILEINFO,
+ AP_INIT_FLAG("CookieTracking", ap_set_flag_slot,
+ (void *)APR_OFFSETOF(cookie_dir_rec, enabled), OR_FILEINFO,
"whether or not to enable cookies"),
AP_INIT_TAKE1("CookieName", set_cookie_name, NULL, OR_FILEINFO,
"name of the tracking cookie"),