summaryrefslogtreecommitdiffstats
path: root/modules/mappers
diff options
context:
space:
mode:
authorRuediger Pluem <rpluem@apache.org>2008-06-07 14:50:04 +0200
committerRuediger Pluem <rpluem@apache.org>2008-06-07 14:50:04 +0200
commitcf66e3894d30bf7608f703cde0a5af63d4485f78 (patch)
tree4556ba979357dd754c623b7c07f0283b3effd29a /modules/mappers
parent* Allow HttpOnly, 1 and true to enable HttpOnly, allow secure, 1 and true (diff)
downloadapache2-cf66e3894d30bf7608f703cde0a5af63d4485f78.tar.xz
apache2-cf66e3894d30bf7608f703cde0a5af63d4485f78.zip
* Offer the possibility to create session cookies in the case a path is
given. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@664333 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/mappers')
-rw-r--r--modules/mappers/mod_rewrite.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c
index 10e50dd9bf..73379caeb0 100644
--- a/modules/mappers/mod_rewrite.c
+++ b/modules/mappers/mod_rewrite.c
@@ -2475,23 +2475,30 @@ static void add_cookie(request_rec *r, char *s)
if (expires) {
apr_time_exp_t tms;
- apr_time_exp_gmt(&tms, r->request_time
- + apr_time_from_sec((60 * atol(expires))));
- exp_time = apr_psprintf(r->pool, "%s, %.2d-%s-%.4d "
- "%.2d:%.2d:%.2d GMT",
- apr_day_snames[tms.tm_wday],
- tms.tm_mday,
- apr_month_snames[tms.tm_mon],
- tms.tm_year+1900,
- tms.tm_hour, tms.tm_min, tms.tm_sec);
+ long exp_min;
+
+ exp_min = atol(expires);
+ if (exp_min) {
+ apr_time_exp_gmt(&tms, r->request_time
+ + apr_time_from_sec((60 * exp_min)));
+ exp_time = apr_psprintf(r->pool, "%s, %.2d-%s-%.4d "
+ "%.2d:%.2d:%.2d GMT",
+ apr_day_snames[tms.tm_wday],
+ tms.tm_mday,
+ apr_month_snames[tms.tm_mon],
+ tms.tm_year+1900,
+ tms.tm_hour, tms.tm_min, tms.tm_sec);
+ }
}
cookie = apr_pstrcat(rmain->pool,
var, "=", val,
"; path=", path ? path : "/",
"; domain=", domain,
- expires ? "; expires=" : NULL,
- expires ? exp_time : NULL,
+ expires ? (exp_time ? "; expires=" : "")
+ : NULL,
+ expires ? (exp_time ? exp_time : "")
+ : NULL,
(secure && (!strcasecmp(secure, "true")
|| !strcmp(secure, "1")
|| !strcasecmp(secure,