summaryrefslogtreecommitdiff
path: root/modules/session
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2020-03-02 00:58:36 +0000
committerEric Covener <covener@apache.org>2020-03-02 00:58:36 +0000
commit6b7a8cc7c125b727c7757c1cb286ef1b53c7e25b (patch)
tree66eaecc0cc0ce4b8184a8dc282c8802a85e40fa0 /modules/session
parentbef4205da37ec1839e6eecc4e8ef56b29829988c (diff)
downloadhttpd-6b7a8cc7c125b727c7757c1cb286ef1b53c7e25b.tar.gz
PR56040: add SessionCookieMaxAge On/Off
Allows mod_session cookies to out as "session" cookies. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874675 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/session')
-rw-r--r--modules/session/mod_session_cookie.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/modules/session/mod_session_cookie.c b/modules/session/mod_session_cookie.c
index 25ca16e242..d91cad2be6 100644
--- a/modules/session/mod_session_cookie.c
+++ b/modules/session/mod_session_cookie.c
@@ -36,6 +36,8 @@ typedef struct {
const char *name2_attrs;
int remove;
int remove_set;
+ int maxage;
+ int maxage_set;
} session_cookie_dir_conf;
/**
@@ -59,12 +61,13 @@ static apr_status_t session_cookie_save(request_rec * r, session_rec * z)
session_cookie_dir_conf *conf = ap_get_module_config(r->per_dir_config,
&session_cookie_module);
+ int maxage = conf->maxage ? z->maxage : 0;
/* create RFC2109 compliant cookie */
if (conf->name_set) {
if (z->encoded && z->encoded[0]) {
ap_cookie_write(r, conf->name, z->encoded, conf->name_attrs,
- z->maxage, r->err_headers_out,
+ maxage, r->err_headers_out,
NULL);
}
else {
@@ -77,7 +80,7 @@ static apr_status_t session_cookie_save(request_rec * r, session_rec * z)
if (conf->name2_set) {
if (z->encoded && z->encoded[0]) {
ap_cookie_write2(r, conf->name2, z->encoded, conf->name2_attrs,
- z->maxage, r->err_headers_out,
+ maxage, r->err_headers_out,
NULL);
}
else {
@@ -172,6 +175,7 @@ static void *create_session_cookie_dir_config(apr_pool_t * p, char *dummy)
{
session_cookie_dir_conf *new =
(session_cookie_dir_conf *) apr_pcalloc(p, sizeof(session_cookie_dir_conf));
+ new->maxage = 1;
return (void *) new;
}
@@ -192,6 +196,8 @@ static void *merge_session_cookie_dir_config(apr_pool_t * p, void *basev,
new->name2_set = add->name2_set || base->name2_set;
new->remove = (add->remove_set == 0) ? base->remove : add->remove;
new->remove_set = add->remove_set || base->remove_set;
+ new->maxage = (add->maxage_set == 0) ? base->maxage : add->maxage;
+ new->maxage_set = add->maxage_set || base->maxage_set;
return new;
}
@@ -253,6 +259,16 @@ static const char *
return NULL;
}
+static const char *
+ set_maxage(cmd_parms * parms, void *dconf, int flag)
+{
+ session_cookie_dir_conf *conf = dconf;
+
+ conf->maxage = flag;
+ conf->maxage_set = 1;
+
+ return NULL;
+}
static const command_rec session_cookie_cmds[] =
{
AP_INIT_RAW_ARGS("SessionCookieName", set_cookie_name, NULL, RSRC_CONF|OR_AUTHCFG,
@@ -262,6 +278,9 @@ static const command_rec session_cookie_cmds[] =
AP_INIT_FLAG("SessionCookieRemove", set_remove, NULL, RSRC_CONF|OR_AUTHCFG,
"Set to 'On' to remove the session cookie from the headers "
"and hide the cookie from a backend server or process"),
+ AP_INIT_FLAG("SessionCookieMaxAge", set_maxage, NULL, RSRC_CONF|OR_AUTHCFG,
+ "Set to 'Off' to disable propogating SessionMaxAge to the client"),
+
{NULL}
};