r1161 - in branches/1.0: . bin/varnishncsa

des at projects.linpro.no des at projects.linpro.no
Wed Oct 18 16:26:45 CEST 2006


Author: des
Date: 2006-10-18 16:26:45 +0200 (Wed, 18 Oct 2006)
New Revision: 1161

Modified:
   branches/1.0/
   branches/1.0/bin/varnishncsa/varnishncsa.c
Log:
 r31753 at cat (orig r1122):  andersb | 2006-09-24 18:17:06 +0200
 Fixed: [] around time. NCSA logformat requires it.
 Fixed: Status variable is not shown correctly.
 Added: base64() decode of Remote User.
 
 Note: Getting compile warning.
 
 



Property changes on: branches/1.0
___________________________________________________________________
Name: svk:merge
   - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1121
   + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1122

Modified: branches/1.0/bin/varnishncsa/varnishncsa.c
===================================================================
--- branches/1.0/bin/varnishncsa/varnishncsa.c	2006-10-18 14:26:42 UTC (rev 1160)
+++ branches/1.0/bin/varnishncsa/varnishncsa.c	2006-10-18 14:26:45 UTC (rev 1161)
@@ -61,6 +61,7 @@
 	char df_b[12];			/* Datafield for %b, Bytes	*/
 	char *df_R; 			/* Datafield for %{Referer}	*/
 	char *df_U; 			/* Datafield for %{User-agent}	*/
+	char *df_RU;				/* Datafield for %l, Remote user */
 	int bogus_req; 			/* bogus request		*/
 	struct vsb *sb;
 } *ll[65536];
@@ -87,6 +88,7 @@
 	FILE *fo;
 	time_t t;
 	long l;
+	unsigned lu;
 	struct tm tm;
 	char tbuf[40];
 	struct logline *lp;
@@ -120,6 +122,8 @@
 			vsb_bcat(lp->sb, ptr, len);
 		} else if (ispfx(ptr, len, "GET")) {
 			vsb_bcat(lp->sb, ptr, len);
+		} else if (ispfx(ptr, len, "PURGE")) {
+			vsb_bcat(lp->sb, ptr, len);
 		} else {
 			lp->bogus_req = 1;
 		}
@@ -144,6 +148,8 @@
 			lp->df_U = strdup(ptr + 12);
 		else if (ispfx(ptr, len, "referer:"))
 			lp->df_R = strdup(ptr + 9);
+		else if (ispfx(ptr, len, "authorization:"))
+			lp->df_RU = strdup(ptr + 21);
 		break;
 
 	case SLT_Length:
@@ -163,10 +169,29 @@
 	assert(1 == sscanf(ptr, "%*u %*u.%*u %ld.", &l));
 	t = l;
 	localtime_r(&t, &tm);
+	
+
+	
 	strftime(tbuf, sizeof tbuf, "%d/%b/%Y:%T %z", &tm);
-	fprintf(fo, "%s - - %s", lp->df_h, tbuf);
+	fprintf(fo, "%s", lp->df_h);
+	
+	if (lp->df_RU != NULL){
+		base64_init();
+		lu = sizeof lp->df_RU;
+		base64_decode(lp->df_RU, &lu, lp->df_RU);
+		q = strchr(lp->df_RU, ':');
+		*q = '\0';
+		fprintf(fo, " %s", lp->df_RU);
+		free(lp->df_RU);
+		lp->df_RU = NULL;
+	}
+	else{
+		fprintf(fo, " -");
+	}
+	fprintf(fo, " - [%s]", tbuf);
 	vsb_finish(lp->sb);
 	fprintf(fo, " \"%s\"", vsb_data(lp->sb));
+	fprintf(fo, " %s", lp->df_s);
 	fprintf(fo, " %s", lp->df_b);
 	if (lp->df_R != NULL) {
 		fprintf(fo, " \"%s\"", lp->df_R);




More information about the varnish-commit mailing list