You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Mark J Cox <mj...@hyperreal.com> on 1996/11/01 15:46:00 UTC
cvs commit: apache/src mod_usertrack.c
mjc 96/11/01 06:45:59
Modified: src mod_usertrack.c
Log:
Bug fix; was missing first cookie even though docs said it didn't
Revision Changes Path
1.3 +10 -9 apache/src/mod_usertrack.c
Index: mod_usertrack.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_usertrack.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C3 -r1.2 -r1.3
*** mod_usertrack.c 1996/10/31 00:13:23 1.2
--- mod_usertrack.c 1996/11/01 14:45:58 1.3
***************
*** 50,56 ****
*
*/
! /* $Id: mod_usertrack.c,v 1.2 1996/10/31 00:13:23 brian Exp $ */
/* User Tracking Module (Was mod_cookies.c)
*
--- 50,56 ----
*
*/
! /* $Id: mod_usertrack.c,v 1.3 1996/11/01 14:45:58 mjc Exp $ */
/* User Tracking Module (Was mod_cookies.c)
*
***************
*** 123,129 ****
cookie_log_state *cls = get_module_config (r->server->module_config,
&usertrack_module);
struct timeval tv;
! char new_cookie[100]; /* blurgh */
char *dot;
const char *rname = pstrdup(r->pool,
get_remote_host(r->connection, r->per_dir_config,
--- 123,130 ----
cookie_log_state *cls = get_module_config (r->server->module_config,
&usertrack_module);
struct timeval tv;
! char *new_cookie = palloc( r->pool, 100); /* 100 = blurgh */
! char *cookiebuf = palloc( r->pool, 100);
char *dot;
const char *rname = pstrdup(r->pool,
get_remote_host(r->connection, r->per_dir_config,
***************
*** 134,139 ****
--- 135,143 ----
if ((dot = strchr(rname,'.'))) *dot='\0'; /* First bit of hostname */
gettimeofday(&tv, &tz);
+ sprintf(cookiebuf, "%s%d%ld%d", rname, (int)getpid(),
+ (long)tv.tv_sec, (int)tv.tv_usec/1000);
+
if (cls->expires) {
static const char *const days[7]=
{"Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
***************
*** 153,172 ****
/* Cookie with date; as strftime '%a, %d-%h-%y %H:%M:%S GMT' */
sprintf(new_cookie,
! "%s%s%d%ld%d; path=/; expires=%s, %.2d-%s-%.2d %.2d:%.2d:%.2d GMT",
! COOKIE_NAME, rname, (int)getpid(),
! (long)tv.tv_sec, (int)tv.tv_usec/1000, days[tms->tm_wday],
tms->tm_mday, month_snames[tms->tm_mon],
(tms->tm_year >= 100) ? tms->tm_year - 100 : tms->tm_year,
tms->tm_hour, tms->tm_min, tms->tm_sec);
}
else
! sprintf(new_cookie,"%s%s%d%ld%d; path=/",
! COOKIE_NAME, rname,
! (int)getpid(),
! (long)tv.tv_sec, (int)tv.tv_usec/1000 );
table_set(r->headers_out,"Set-Cookie",new_cookie);
return;
}
--- 157,173 ----
/* Cookie with date; as strftime '%a, %d-%h-%y %H:%M:%S GMT' */
sprintf(new_cookie,
! "%s%s; path=/; expires=%s, %.2d-%s-%.2d %.2d:%.2d:%.2d GMT",
! COOKIE_NAME, cookiebuf, days[tms->tm_wday],
tms->tm_mday, month_snames[tms->tm_mon],
(tms->tm_year >= 100) ? tms->tm_year - 100 : tms->tm_year,
tms->tm_hour, tms->tm_min, tms->tm_sec);
}
else
! sprintf(new_cookie,"%s%s; path=/", COOKIE_NAME, cookiebuf);
table_set(r->headers_out,"Set-Cookie",new_cookie);
+ table_set(r->notes, "cookie", cookiebuf); /* log first time */
return;
}