From: William A. Rowe Jr Date: Mon, 1 Oct 2001 15:47:12 +0000 (+0000) Subject: Kill off some expensive, unnecessary effort when we use max-age for X-Git-Tag: 2.0.26~140 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=1037fbd63deb3e4ce1b6d72c61c90b9fd1cf0cd4;p=thirdparty%2Fapache%2Fhttpd.git Kill off some expensive, unnecessary effort when we use max-age for the usertrack cookie (and kill a warning in the process.) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91215 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/metadata/mod_usertrack.c b/modules/metadata/mod_usertrack.c index 67d23f9b5ac..a5aa13ab50e 100644 --- a/modules/metadata/mod_usertrack.c +++ b/modules/metadata/mod_usertrack.c @@ -149,21 +149,15 @@ static void make_cookie(request_rec *r) apr_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%qd", rname, apr_time_now()); if (cls->expires) { - apr_exploded_time_t tms; - time_t when; - - when = cls->expires; - if ((dcfg->style == CT_UNSET) || (dcfg->style == CT_NETSCAPE)) { - when += r->request_time; - } - - apr_explode_gmt(&tms, - r->request_time + cls->expires * APR_USEC_PER_SEC); /* Cookie with date; as strftime '%a, %d-%h-%y %H:%M:%S GMT' */ new_cookie = apr_psprintf(r->pool, "%s=%s; path=/", dcfg->cookie_name, cookiebuf); + if ((dcfg->style == CT_UNSET) || (dcfg->style == CT_NETSCAPE)) { + apr_exploded_time_t tms; + apr_explode_gmt(&tms, r->request_time + + cls->expires * APR_USEC_PER_SEC); new_cookie = apr_psprintf(r->pool, "%s; expires=%s, " "%.2d-%s-%.2d %.2d:%.2d:%.2d GMT", @@ -175,7 +169,7 @@ static void make_cookie(request_rec *r) } else { new_cookie = apr_psprintf(r->pool, "%s; max-age=%d", - new_cookie, (int) when); + new_cookie, cls->expires); } } else {