Package: jesred / 1.2pl1-19

05-squid3 Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Author: Alexander Zangerl <az@debian.org>
Subject: add support for squid 3

--- a/rewrite.c
+++ b/rewrite.c
@@ -94,6 +94,18 @@ parse_buff(char *buff, char **url, char
 		end[2] = token;
 		*ident = new_token;
 
+		/* az Tue Nov 11 09:12:04 2008
+		   message format changed between 2.5 and 2.6, and again
+		   between 2 and 3...*sigh*
+
+		   squid 2.6: URL <SP> client_ip "/" fqdn <SP> user <SP> 
+		    method <SP> urlgroup [<SP> kvpairs] <NL>
+		   squid 3: same but without the urlgroup column.
+
+		   no space after method: no urlgroup
+		   space but no = after method: 2.6, urlgroup
+		   space but = after method: 3, no urlgroup.
+		*/
 		/* this might be the last token, check for a space
 		 or a newline */
 		if (!( new_token = strchr(++token,' ')))
@@ -104,23 +116,25 @@ parse_buff(char *buff, char **url, char
 		    end[3] = new_token;
 		    *method = token;
 
-		    /* this will be the last token, stop at a space or newline
-                       to avoid spaces in urlgroup.  maybe be too rare to 
-                       waste a test on */
+		    /* here goes urlgroup or optional k=v pairs */
 		    if (!( token = strchr(++new_token,' ')))
-			token = strchr(new_token,'\n');
-		    if (token) {      /* urlgroup */
-			c++;
-			*token = '\0';
-			end[4] = token;
-			/* squid sends "-" as indicator for no urlgroup  */
-			if (strcmp(new_token,"-"))
-			   *urlgroup = new_token;
-
+		       token = strchr(new_token,'\n');
+		    if (token)       /* urlgroup or k/v pairs*/
+		    {
+		       c++;
+		       *token = '\0';
+		       end[4] = token;
+		       /* squid 2.6+ sends "-" as indicator for no urlgroup,
+			  squid 3 has no urlgroups.
+			  note: this can't ever work with an urlgroup that has 
+			  equal signs in it... 
+			*/
+		       if (strcmp(new_token,"-") && !strchr(new_token,'='))
+			     *urlgroup = new_token;
+		    }
+		    
 		}
 	    }
-
-	    }
 	}
     }