diff -du ./access_log.c ./access_log.c --- ./access_log.c 2002-09-24 06:59:13.000000000 -0400 +++ ./access_log.c 2003-01-30 20:24:52.000000000 -0500 @@ -271,7 +271,22 @@ client = inet_ntoa(al->cache.caddr); user1 = accessLogFormatName(al->cache.authuser); user2 = accessLogFormatName(al->cache.rfc931); - logfilePrintf(logfile, "%s %s %s [%s] \"%s %s HTTP/%d.%d\" %d %ld %s:%s", +#ifdef REIF_LOGS + logfilePrintf(logfile, "%s %s %s [%s] \"%s %s HTTP/%d.%d\" %d %ld \"%s\" \"%s\"", + client, + user2 ? user2 : dash_str, + user1 ? user1 : dash_str, + mkhttpdlogtime(&squid_curtime), + al->_private.method_str, + al->url, + al->http.version.major, al->http.version.minor, + al->http.code, + (long int) al->cache.size, + al->request->referer[0] ? al->request->referer : dash_str, //Referer + al->request->user_agent[0] ? al->request->user_agent : dash_str //User-Agent + ); +#else + logfilePrintf(logfile, "%s %s %s [%s] \"%s %s HTTP/%d.%d\" %d %ld %s:%s", client, user2 ? user2 : dash_str, user1 ? user1 : dash_str, @@ -283,6 +298,7 @@ (long int) al->cache.size, log_tags[al->cache.code], hier_strings[al->hier.code]); +#endif safe_free(user1); safe_free(user2); } diff -du ./client_side.c ./client_side.c --- ./client_side.c 2003-01-27 22:16:20.000000000 -0500 +++ ./client_side.c 2003-01-30 13:37:51.000000000 -0500 @@ -361,6 +361,9 @@ aLogEntry->http.version = request->http_ver; aLogEntry->headers.request = xstrdup(mb.buf); aLogEntry->hier = request->hier; +#ifdef REIF_LOGS + aLogEntry->request = request; +#endif if (request->auth_user_request) { aLogEntry->cache.authuser = xstrdup(authenticateUserRequestUsername(request-> @@ -1424,6 +1427,18 @@ request->my_addr = conn->me.sin_addr; request->my_port = ntohs(conn->me.sin_port); request->http_ver = http->http_ver; +#ifdef REIF_LOGS + //Set the vars to something reasonable. + // Of course, we face the "" vs. NULL problem here, and + //don't have pointers to fall back on. My solution is to + //have it default to blank. + // Yes, with this approach, we will miss out on those clients + //that specify a BLANK referer or user-agent header by confusing + //them with those that send none at all, but the number of clients + //that do so is small and there is not a very good alternate value. + request->user_agent[0] = '\0'; + request->referer[0] = '\0'; +#endif if (!urlCheckRequest(request) || httpHeaderHas(&request->header, HDR_TRANSFER_ENCODING)) { clientStreamNode *node = getClientReplyContext(context); diff -du ./client_side_request.c ./client_side_request.c --- ./client_side_request.c 2002-10-03 08:55:28.000000000 -0400 +++ ./client_side_request.c 2003-01-30 16:48:57.000000000 -0500 @@ -445,11 +445,25 @@ } #if USE_USERAGENT_LOG if ((str = httpHeaderGetStr(req_hdr, HDR_USER_AGENT))) + { logUserAgent(fqdnFromAddr(http->conn ? http->conn->log_addr : no_addr), str); + + #ifdef REIF_LOGS + strncpy( request->user_agent, str, MAX_USER_AGENT_SZ-1 ); + request->user_agent[MAX_USER_AGENT_SZ-1] = '\0'; + #endif + } #endif #if USE_REFERER_LOG if ((str = httpHeaderGetStr(req_hdr, HDR_REFERER))) + { logReferer(fqdnFromAddr(http->conn ? http->conn->log_addr : no_addr), str, http->log_uri); + + #ifdef REIF_LOGS + strncpy( request->referer, str, MAX_REFERER_SZ-1 ); + request->referer[MAX_REFERER_SZ-1] = '\0'; + #endif + } #endif #if FORW_VIA_DB if (httpHeaderHas(req_hdr, HDR_X_FORWARDED_FOR)) { diff -du ./defines.h ./defines.h --- ./defines.h 2002-09-15 07:06:31.000000000 -0400 +++ ./defines.h 2003-01-30 14:55:15.000000000 -0500 @@ -31,6 +31,8 @@ * */ +#define REIF_LOGS + #ifndef SQUID_DEFINES_H #define SQUID_DEFINES_H @@ -154,6 +156,13 @@ #define MAX_URL 4096 #define MAX_LOGIN_SZ 128 +#ifdef REIF_LOGS + //Things will break if these is set to anything less than 2. + + #define MAX_REFERER_SZ 512 + #define MAX_USER_AGENT_SZ 512 +#endif + #define PEER_MAX_ADDRESSES 10 #define RTT_AV_FACTOR 50 #define RTT_BACKGROUND_AV_FACTOR 25 /* Background pings need a smaller factor since they are sent less frequently */ diff -du ./structs.h ./structs.h --- ./structs.h 2003-01-20 22:13:57.000000000 -0500 +++ ./structs.h 2003-01-30 13:36:12.000000000 -0500 @@ -1050,6 +1050,9 @@ struct { const char *method_str; } _private; +#ifdef REIF_LOGS + request_t * request; +#endif HierarchyLogEntry hier; }; @@ -1641,6 +1644,10 @@ struct in_addr my_addr; unsigned short my_port; HttpHeader header; +#ifdef REIF_LOGS + char referer[MAX_REFERER_SZ]; + char user_agent[MAX_USER_AGENT_SZ]; +#endif ConnStateData *body_connection; /* used by clientReadBody() */ int content_length; HierarchyLogEntry hier;