Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37815254
en ru br
ALT Linux repos
S:6.3-alt1
5.0: 3.0.STABLE15-alt0.M50.1
4.1: 3.0.STABLE15-alt0.M41.1
4.0: 3.0.STABLE15-alt0.M40.1
3.0: 2.5.STABLE11-alt2

Group :: System/Servers
RPM: squid

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: patch-aa.patch
Download


diff -Nur squid-2.5.STABLE6.orig/src/access_log.c squid-2.5.STABLE6/src/access_log.c
--- squid-2.5.STABLE6.orig/src/access_log.c	2004-07-23 11:49:01 +0600
+++ squid-2.5.STABLE6/src/access_log.c	2004-07-23 13:00:57 +0600
@@ -224,7 +224,7 @@
     return buf;
 }
 
-static char *
+char *
 accessLogFormatName(const char *name)
 {
     if (NULL == name)
diff -Nur squid-2.5.STABLE6.orig/src/client_side.c squid-2.5.STABLE6/src/client_side.c
--- squid-2.5.STABLE6.orig/src/client_side.c	2004-07-23 11:49:01 +0600
+++ squid-2.5.STABLE6/src/client_side.c	2004-07-23 13:01:24 +0600
@@ -2186,6 +2186,94 @@
 	kb_incr(&statCounter.client_http.kbytes_out, size);
 	if (isTcpHit(http->log_type))
 	    kb_incr(&statCounter.client_http.hit_kbytes_out, size);
+	{
+	extern int acfd;
+	extern char *acfifo;	/* XXX: for error handling */
+
+	if (acfd > -1) { 	
+		AccessLogEntry * al = &http->al;
+    		const char *client = NULL;
+    		char *user = NULL;
+		extern char *accessLogFormatName(const char *name);
+		char buf[0x4000];
+		int n;
+
+		ConnStateData *conn = http->conn;
+		request_t *request = http->request;
+		MemObject *mem = NULL;
+
+		if (http->entry)
+			mem = http->entry->mem_obj;
+    		if (http->out.size || http->log_type) {
+			http->al.icp.opcode = ICP_INVALID;
+			http->al.url = http->log_uri;
+			if (mem) {
+	    			http->al.http.code = mem->reply->sline.status;
+	    			http->al.http.content_type = 
+					strBuf(mem->reply->content_type);
+			}
+			http->al.cache.caddr = conn->log_addr;
+			http->al.cache.size = http->out.size;
+			http->al.cache.code = http->log_type;
+			http->al.cache.msec = tvSubMsec(http->start, 
+						current_time);
+			if (request) {
+	    			Packer p;
+	    			MemBuf mb;
+	    			memBufDefInit(&mb);
+	    			packerToMemInit(&p, &mb);
+	    			httpHeaderPackInto(&request->header, &p);
+	    			http->al.http.method = request->method;
+	    			http->al.http.version = request->http_ver;
+	    			http->al.headers.request = xstrdup(mb.buf);
+	    			http->al.hier = request->hier;
+	    			if (request->auth_user_request) {
+					http->al.cache.authuser = xstrdup(
+						authenticateUserRequestUsername(
+							request->auth_user_request));
+					authenticateAuthUserRequestUnlock(
+							request->auth_user_request);
+					request->auth_user_request = NULL;
+	    			}
+	    			if (conn->rfc931[0])
+					http->al.cache.rfc931 = conn->rfc931;
+	    			packerClean(&p);
+	    			memBufClean(&mb);
+			}
+
+    			if (Config.onoff.log_fqdn)
+				client = fqdncache_gethostbyaddr(
+					al->cache.caddr, FQDN_LOOKUP_IF_MISS);
+    			if (client == NULL)
+				client = inet_ntoa(al->cache.caddr);
+
+    			user = accessLogFormatName(al->cache.authuser ?
+					al->cache.authuser : al->cache.rfc931);
+    			n = snprintf(buf, sizeof buf, 
+				"%9d.%03d %6d %s %s/%03d %ld (+%ld) "
+				"%s %s %s%s/%s %s\n",
+				(int) current_time.tv_sec, 
+				(int) current_time.tv_usec / 1000,
+				al->cache.msec,
+				client,
+				log_tags[al->cache.code],
+				al->http.code,
+				(long int) al->cache.size,
+				size,
+				al->url,
+				user && *user ? user : dash_str,
+				al->hier.ping.timedout ? "TIMEOUT_" : "",
+				hier_strings[al->hier.code],
+				al->hier.host,
+				al->http.content_type);
+
+			/* XXX: blocking write */
+			write(acfd, buf, n > sizeof buf ? sizeof buf : n);
+
+    			safe_free(user);
+		}
+	} /* if */
+	}
     }
 #if SIZEOF_SIZE_T == 4
     if (http->out.size > 0x7FFF0000) {
diff -Nur squid-2.5.STABLE6.orig/src/main.c squid-2.5.STABLE6/src/main.c
--- squid-2.5.STABLE6.orig/src/main.c	2004-07-23 11:49:01 +0600
+++ squid-2.5.STABLE6/src/main.c	2004-07-23 13:01:55 +0600
@@ -35,6 +35,10 @@
 
 #include "squid.h"
 
+int acfd = -1;
+char *acfifo = NULL;
+
+
 /* for error reporting from xmalloc and friends */
 extern void (*failure_notify) (const char *);
 
@@ -95,6 +99,7 @@
 	"       -s        Enable logging to syslog.\n"
 	"       -u port   Specify ICP port number (default: %d), disable with 0.\n"
 	"       -v        Print version.\n"
+	"       -x fifo   Print account log to fifo. default: /dev/null :))\n"
 	"       -z        Create swap directories\n"
 	"       -C        Do not catch fatal signals.\n"
 	"       -D        Disable initial DNS tests.\n"
@@ -115,7 +120,10 @@
     extern char *optarg;
     int c;
 
-    while ((c = getopt(argc, argv, "CDFNRSVYXa:d:f:hk:m::su:vz?")) != -1) {
+    while ((c = getopt(argc, argv, 
+			"CDFNRSVYXa:d:f:hk:m::su:v"
+			"x:"
+			"z?")) != -1) {
 	switch (c) {
 	case 'C':
 	    opt_catch_signals = 0;
@@ -222,6 +230,9 @@
 	    printf("Squid Cache: Version %s\nconfigure options: %s\n", version_string, SQUID_CONFIGURE_OPTIONS);
 	    exit(0);
 	    /* NOTREACHED */
+	case 'x': 
+		acfifo = optarg;
+		break;
 	case 'z':
 	    opt_create_swap_dirs = 1;
 	    break;
@@ -579,6 +590,18 @@
 	eventAdd("ipcache_purgelru", ipcache_purgelru, NULL, 10.0, 1);
 	eventAdd("fqdncache_purgelru", fqdncache_purgelru, NULL, 15.0, 1);
     }
+	if (!configured_once && acfifo)
+		for (;;) {
+			if ((acfd = open(acfifo, O_WRONLY)) < 0) {
+				if (errno == EINTR)
+					continue;
+				if (errno == ENOENT &&
+						mkfifo(acfifo, 0640) < 0)
+					err(1, acfifo);
+				continue;
+			}
+			break;
+		}
     configured_once = 1;
 }
 
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin