#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.in,v 1.190 2000/06/27 08:35:09 hno Exp $
+# $Id: Makefile.in,v 1.191 2000/07/13 06:13:42 wessels Exp $
#
# Uncomment and customize the following to suit your needs:
#
peer_select.o \
pump.o \
redirect.o \
+ referer.o \
refresh.o \
repl_modules.o \
send-announce.o \
#
-# $Id: cf.data.pre,v 1.191 2000/06/26 04:57:16 wessels Exp $
+# $Id: cf.data.pre,v 1.192 2000/07/13 06:13:42 wessels Exp $
#
#
# SQUID Internet Object Cache http://squid.nlanr.net/Squid/
DOC_END
+NAME: referer_log
+TYPE: string
+LOC: Config.Log.referer
+DEFAULT: none
+DOC_START
+ If configured with the "--enable-referer_log" configure
+ option, Squid will write the Referer field from HTTP
+ requests to the filename specified here. By default
+ referer_log is disabled.
+
+referer_log none
+DOC_END
+
+
NAME: pid_filename
TYPE: string
DEFAULT: @DEFAULT_PID_FILE@
/*
- * $Id: client_side.cc,v 1.491 2000/07/12 16:20:02 wessels Exp $
+ * $Id: client_side.cc,v 1.492 2000/07/13 06:13:42 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
request_t *request = http->request;
const HttpHeader *req_hdr = &request->header;
int no_cache = 0;
-#if USE_USERAGENT_LOG
+#if defined(USE_USERAGENT_LOG) || defined(USE_REFERER_LOG)
const char *str;
#endif
request->imslen = -1;
if ((str = httpHeaderGetStr(req_hdr, HDR_USER_AGENT)))
logUserAgent(fqdnFromAddr(http->conn->peer.sin_addr), str);
#endif
+#if USE_REFERER_LOG
+ if ((str = httpHeaderGetStr(req_hdr, HDR_REFERER)))
+ logReferer(fqdnFromAddr(http->conn->peer.sin_addr), str,
+ http->log_uri);
+#endif
#if FORW_VIA_DB
if (httpHeaderHas(req_hdr, HDR_X_FORWARDED_FOR)) {
String s = httpHeaderGetList(req_hdr, HDR_X_FORWARDED_FOR);
/*
- * $Id: main.cc,v 1.315 2000/06/27 22:06:03 hno Exp $
+ * $Id: main.cc,v 1.316 2000/07/13 06:13:42 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
storeLogRotate(); /* store.log */
accessLogRotate(); /* access.log */
useragentRotateLog(); /* useragent.log */
+ refererRotateLog(); /* referer.log */
icmpOpen();
#if USE_DNSSERVERS
dnsInit();
redirectInit();
authenticateInit();
useragentOpenLog();
+ refererOpenLog();
httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */
httpReplyInitModule(); /* must go before accepting replies */
errorInitialize();
/*
- * $Id: protos.h,v 1.375 2000/06/27 08:41:30 hno Exp $
+ * $Id: protos.h,v 1.376 2000/07/13 06:13:42 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern void useragentOpenLog(void);
extern void useragentRotateLog(void);
extern void logUserAgent(const char *, const char *);
+extern void refererOpenLog(void);
+extern void refererRotateLog(void);
+extern void logReferer(const char *, const char *, const char *);
extern peer_t parseNeighborType(const char *s);
extern void errorInitialize(void);
--- /dev/null
+
+/*
+ * $Id: referer.cc,v 1.1 2000/07/13 06:13:43 wessels Exp $
+ *
+ * DEBUG: section 40 User-Agent and Referer logging
+ * AUTHOR: Joe Ramey <ramey@csc.ti.com> (useragent)
+ * Jens-S. Vöckler <voeckler@rvs.uni-hannover.de> (mod 4 referer)
+ *
+ * SQUID Internet Object Cache http://squid.nlanr.net/Squid/
+ * ----------------------------------------------------------
+ *
+ * Squid is the result of efforts by numerous individuals from the
+ * Internet community. Development is led by Duane Wessels of the
+ * National Laboratory for Applied Network Research and funded by the
+ * National Science Foundation. Squid is Copyrighted (C) 1998 by
+ * the Regents of the University of California. Please see the
+ * COPYRIGHT file for full details. Squid incorporates software
+ * developed and/or copyrighted by other sources. Please see the
+ * CREDITS file for full details.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "squid.h"
+
+#if USE_REFERER_LOG
+static Logfile *refererlog = NULL;
+#endif
+
+void
+refererOpenLog(void)
+{
+#if USE_REFERER_LOG
+ assert(NULL == refererlog);
+ if (!Config.Log.referer || (0 == strcmp(Config.Log.referer, "none"))) {
+ debug(40, 1) ("Referer logging is disabled.\n");
+ return;
+ }
+ logfileOpen(Config.Log.referer, 0);
+#endif
+}
+
+void
+refererRotateLog(void)
+{
+#if USE_REFERER_LOG
+ if (NULL == refererlog)
+ return;
+ logfileRotate(refererlog);
+#endif
+}
+
+void
+logReferer(const char *client, const char *referer, const char *uri)
+{
+#if USE_REFERER_LOG
+ if (NULL == refererlog)
+ return;
+ logfilePrintf(refererlog, "%9d.%03d %s %s %s\n",
+ (int) current_time.tv_sec,
+ (int) current_time.tv_usec / 1000,
+ client,
+ referer,
+ uri ? uri : "-");
+#endif
+}
/*
- * $Id: structs.h,v 1.346 2000/06/27 08:41:31 hno Exp $
+ * $Id: structs.h,v 1.347 2000/07/13 06:13:43 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
char *swap;
#if USE_USERAGENT_LOG
char *useragent;
+#endif
+#if USE_REFERER_LOG
+ char *referer;
#endif
int rotateNumber;
} Log;