From: wessels <> Date: Mon, 22 Jul 1996 23:20:59 +0000 (+0000) Subject: change log_append() to use an in_addr instead of a string X-Git-Tag: SQUID_3_0_PRE1~6010 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b7f3c2632346a475ef6f1916062ab0f0d20596c8;p=thirdparty%2Fsquid.git change log_append() to use an in_addr instead of a string --- diff --git a/src/stat.cc b/src/stat.cc index 2cf9dfd434..2f45d15cea 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.44 1996/07/22 16:40:29 wessels Exp $ + * $Id: stat.cc,v 1.45 1996/07/22 17:20:59 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -891,10 +891,10 @@ void parameter_get(obj, sentry) } -void log_append(obj, url, id, size, action, method, http_code, msec, ident, hier, neighbor) +void log_append(obj, url, caddr, size, action, method, http_code, msec, ident, hier, neighbor) cacheinfo *obj; char *url; - char *id; + struct in_addr caddr; int size; char *action; char *method; @@ -907,24 +907,12 @@ void log_append(obj, url, id, size, action, method, http_code, msec, ident, hier LOCAL_ARRAY(char, tmp, 6000); /* MAX_URL is 4096 */ int x; static char *dash = "-"; + char *client = fqdncache_gethostbyaddr(caddr, 0); - getCurrentTime(); + if (client == NULL) + client = inet_ntoa(caddr); -#ifdef LOG_FQDN - /* ENABLE THIS IF YOU WANT A *SLOW* CACHE, OR - * JUST WRITE A PERL SCRIPT TO MUCK YOUR LOGS */ - { - int ipx[4]; - unsigned long ipy; - struct hostent *h = NULL; - if (sscanf(id, "%d.%d.%d.%d", &ipx[0], &ipx[1], &ipx[2], &ipx[3]) == 4) { - ipy = inet_addr(id); - if (h = gethostbyaddr((char *) &ipy, 4, AF_INET)) { - id = xstrdup(h->h_name); - } - } - } -#endif + getCurrentTime(); if (!method) method = dash; @@ -938,7 +926,7 @@ void log_append(obj, url, id, size, action, method, http_code, msec, ident, hier if (obj->logfile_status == LOG_ENABLE) { if (emulate_httpd_log) sprintf(tmp, "%s %s - [%s] \"%s %s\" %s %d\n", - id, + client, ident, mkhttpdlogtime(&squid_curtime), method, @@ -950,7 +938,7 @@ void log_append(obj, url, id, size, action, method, http_code, msec, ident, hier (int) current_time.tv_sec, (int) current_time.tv_usec / 1000, msec, - id, + client, action, http_code, size,