r958 - trunk/varnish-cache/bin/varnishncsa
andersb at projects.linpro.no
andersb at projects.linpro.no
Mon Sep 11 11:35:43 CEST 2006
Author: andersb
Date: 2006-09-11 11:35:43 +0200 (Mon, 11 Sep 2006)
New Revision: 958
Modified:
trunk/varnish-cache/bin/varnishncsa/varnishncsa.c
Log:
Cleaned up User-Agent and Referer. Both should now work correct. As far as I can see, I only have the timestamp left for a sane loggline.
Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c
===================================================================
--- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-09-11 09:16:59 UTC (rev 957)
+++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2006-09-11 09:35:43 UTC (rev 958)
@@ -200,12 +200,17 @@
// printf("Lengde: %d\n", w);
ll[u].df_U = strdup(p + 4);
+ //strchr(ll[u].df_U, ':');
+ // Jump ahead past "User-Agent: "
+ ll[u].df_U = ll[u].df_U + 12;
ll[u].df_Ufini = 1;
}
- /*
if (p[1] >= 8 && !strncasecmp((void *)&p[4], "referer:",8)){
ll[u].df_R = strdup(p + 4);
+ ll[u].df_R = ll[u].df_R + 9;
+ ll[u].df_Rfini = 1;
}
+ /*
else if (ll[u].df_R == NULL){
ll[u].df_R = strdup(p + 4);
ll[u].df_R[0] = '-';
@@ -322,7 +327,14 @@
printf("[%d] %s - - %s ", u, ll[u].df_h, temp_time );
vsb_finish(ob[u]);
printf("\"%s\"", vsb_data(ob[u]));
- printf(" %s %s \"%s\"", ll[u].df_s, ll[u].df_b, ll[u].df_R);
+ printf(" %s %s ", ll[u].df_s, ll[u].df_b, ll[u].df_R);
+ if (ll[u].df_Rfini){
+ printf(" \"%s\" ", ll[u].df_R);
+ }
+ else {
+ printf(" \"-\" ");
+ }
+
if (ll[u].df_Ufini){
printf(" \"%s\" ", ll[u].df_U);
}
@@ -359,6 +371,7 @@
// Clean User-Agent and Referer
if (ll[u].df_Ufini){
+ ll[u].df_U = ll[u].df_U - 12;
free(ll[u].df_U);
ll[u].df_Ufini = 0;
ll[u].df_UN[0] = '\0';
@@ -368,8 +381,11 @@
//printf("Jalla: %d\n", jalla);
}
- if (ll[u].df_R != NULL){
+ if (ll[u].df_Rfini){
+ ll[u].df_R = ll[u].df_R - 9;
free(ll[u].df_R);
+ ll[u].df_R[0] = '\0';
+ ll[u].df_Rfini = 0;
//printf("Freed df_R [%d]\n", u);
jalla = strlen(ll[u].df_R);
//printf("Jalla: %d\n", jalla);
More information about the varnish-commit
mailing list