]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Kill off some expensive, unnecessary effort when we use max-age for
authorWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 1 Oct 2001 15:47:12 +0000 (15:47 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 1 Oct 2001 15:47:12 +0000 (15:47 +0000)
  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

modules/metadata/mod_usertrack.c

index 67d23f9b5ac5d050cc98d4d90988088716a1788b..a5aa13ab50eb71816808e2b0e86ac92197050253 100644 (file)
@@ -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 {