summaryrefslogtreecommitdiffstats
path: root/main/squid/squid-3.2.0.12-loggable-urlgroup.patch
blob: ee1646fe588756ed41bc79fae38a0bf5d8df9dbe (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Index: squid-3.2.0.12/src/client_side_request.cc
===================================================================
--- squid-3.2.0.12.orig/src/client_side_request.cc	2011-10-07 20:29:10.000000000 +0300
+++ squid-3.2.0.12/src/client_side_request.cc	2011-10-07 21:54:38.000000000 +0300
@@ -1165,6 +1165,15 @@
     redirect_state = REDIRECT_DONE;
 
     if (result) {
+        if (result[0] == '!') {
+            char *t = strchr(result+1, '!');
+            if (t != NULL) {
+                old_request->urlgroup.reset(NULL);
+                old_request->urlgroup.append(result + 1, t - result - 1);
+                result = t + 1;
+            }
+        }
+
         http_status status = (http_status) atoi(result);
 
         if (status == HTTP_MOVED_PERMANENTLY
@@ -1183,7 +1192,7 @@
                 else
                     debugs(85, DBG_CRITICAL, "ERROR: URL-rewrite produces invalid 303 redirect Location: " << result);
             }
-        } else if (strcmp(result, http->uri)) {
+        } else if (result[0] != 0 && strcmp(result, http->uri)) {
             // XXX: validate the URL properly *without* generating a whole new request object right here.
             // XXX: the clone() should be done only AFTER we know the new URL is valid.
             HttpRequest *new_request = old_request->clone();
Index: squid-3.2.0.12/src/HttpRequest.cc
===================================================================
--- squid-3.2.0.12.orig/src/HttpRequest.cc	2011-10-07 21:02:45.000000000 +0300
+++ squid-3.2.0.12/src/HttpRequest.cc	2011-10-07 21:03:45.000000000 +0300
@@ -106,6 +106,7 @@
     peer_login = NULL;		// not allocated/deallocated by this class
     peer_domain = NULL;		// not allocated/deallocated by this class
     vary_headers = NULL;
+    urlgroup = null_string;
     myportname = null_string;
     tag = null_string;
 #if USE_AUTH
@@ -154,6 +155,7 @@
         range = NULL;
     }
 
+    urlgroup.clean();
     myportname.clean();
 
     tag.clean();
@@ -213,6 +215,7 @@
     copy->vary_headers = vary_headers ? xstrdup(vary_headers) : NULL;
     // XXX: what to do with copy->peer_domain?
 
+    copy->urlgroup = urlgroup;
     copy->myportname = myportname;
     copy->tag = tag;
 #if USE_AUTH
Index: squid-3.2.0.12/src/HttpRequest.h
===================================================================
--- squid-3.2.0.12.orig/src/HttpRequest.h	2011-10-07 21:02:45.000000000 +0300
+++ squid-3.2.0.12/src/HttpRequest.h	2011-10-07 21:02:55.000000000 +0300
@@ -187,6 +187,8 @@
 
     char *peer_domain;		/* Configured peer forceddomain */
 
+    String urlgroup;
+
     String myportname; // Internal tag name= value from port this requests arrived in.
 
     String tag;			/* Internal tag for this request */
Index: squid-3.2.0.12/src/format/Format.cc
===================================================================
--- squid-3.2.0.12.orig/src/format/Format.cc	2011-10-07 21:33:38.000000000 +0300
+++ squid-3.2.0.12/src/format/Format.cc	2011-10-07 21:41:45.000000000 +0300
@@ -895,6 +895,12 @@
             out = tmp;
             break;
 
+        case LFT_REQUEST_URLGROUP:
+            if (al->request)
+                out = al->request->urlgroup.termedBuf();
+            quote = 1;
+            break;
+
         case LFT_SERVER_REQ_METHOD:
             if (al->adapted_request) {
                 out = al->adapted_request->method.image();
Index: squid-3.2.0.12/src/format/Tokens.h
===================================================================
--- squid-3.2.0.12.orig/src/format/Tokens.h	2011-10-07 21:34:25.000000000 +0300
+++ squid-3.2.0.12/src/format/Tokens.h	2011-10-07 21:40:26.000000000 +0300
@@ -100,6 +100,7 @@
     /*LFT_REQUEST_QUERY, */
     LFT_REQUEST_VERSION_OLD_2X,
     LFT_REQUEST_VERSION,
+    LFT_REQUEST_URLGROUP,
 
     /* Request-Line details sent to the server/peer */
     LFT_SERVER_REQ_METHOD,
Index: squid-3.2.0.12/src/format/Tokens.cc
===================================================================
--- squid-3.2.0.12.orig/src/format/Tokens.cc	2011-10-07 21:38:05.000000000 +0300
+++ squid-3.2.0.12/src/format/Tokens.cc	2011-10-07 21:40:55.000000000 +0300
@@ -114,6 +114,7 @@
     {"rp", LFT_REQUEST_URLPATH_OLD_31},
     /* { "rq", LFT_REQUEST_QUERY }, * /     / * the query-string, INCLUDING the leading ? */
     {"rv", LFT_REQUEST_VERSION},
+    {"rG", LFT_REQUEST_URLGROUP},
 
     {"<rm", LFT_SERVER_REQ_METHOD},
     {"<ru", LFT_SERVER_REQ_URI},