You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2001/10/01 17:47:12 UTC

cvs commit: httpd-2.0/modules/metadata mod_usertrack.c

wrowe       01/10/01 08:47:12

  Modified:    modules/metadata mod_usertrack.c
  Log:
    Kill off some expensive, unnecessary effort when we use max-age for
    the usertrack cookie (and kill a warning in the process.)
  
  Revision  Changes    Path
  1.34      +5 -11     httpd-2.0/modules/metadata/mod_usertrack.c
  
  Index: mod_usertrack.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_usertrack.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- mod_usertrack.c	2001/08/29 12:29:36	1.33
  +++ mod_usertrack.c	2001/10/01 15:47:12	1.34
  @@ -149,21 +149,15 @@
       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 @@
           }
           else {
               new_cookie = apr_psprintf(r->pool, "%s; max-age=%d",
  -                                      new_cookie, (int) when);
  +                                      new_cookie, cls->expires);
           }
       }
       else {