aboutsummaryrefslogtreecommitdiffstats
path: root/main/squid/squid-3.2.0.16-loggable-urlgroup.patch
blob: 41193ba85f7af80b1070172de6607d66b544c2b2 (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
diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc
index b464e65..0448078 100644
--- a/src/HttpRequest.cc
+++ b/src/HttpRequest.cc
@@ -107,6 +107,7 @@ HttpRequest::init()
     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
@@ -155,6 +156,7 @@ HttpRequest::clean()
         range = NULL;
     }
 
+    urlgroup.clean();
     myportname.clean();
 
     tag.clean();
@@ -214,6 +216,7 @@ HttpRequest::clone() const
     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
diff --git a/src/HttpRequest.h b/src/HttpRequest.h
index dc44fea..989624d 100644
--- a/src/HttpRequest.h
+++ b/src/HttpRequest.h
@@ -187,6 +187,8 @@ public:
 
     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 */
diff --git a/src/client_side_request.cc b/src/client_side_request.cc
index 0c3113b..d1947e9 100644
--- a/src/client_side_request.cc
+++ b/src/client_side_request.cc
@@ -1180,6 +1180,15 @@ ClientRequestContext::clientRedirectDone(char *result)
     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
@@ -1198,7 +1207,7 @@ ClientRequestContext::clientRedirectDone(char *result)
                 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();
diff --git a/src/format/ByteCode.h b/src/format/ByteCode.h
index 8e345df..ddb0f8f 100644
--- a/src/format/ByteCode.h
+++ b/src/format/ByteCode.h
@@ -65,6 +65,7 @@ typedef enum {
     /*LFT_REQUEST_QUERY, */
     LFT_REQUEST_VERSION_OLD_2X,
     LFT_REQUEST_VERSION,
+    LFT_REQUEST_URLGROUP,
 
     /* request header details pre-adaptation */
     LFT_REQUEST_HEADER,
diff --git a/src/format/Format.cc b/src/format/Format.cc
index 18348e8..2e65886 100644
--- a/src/format/Format.cc
+++ b/src/format/Format.cc
@@ -907,6 +907,12 @@ Format::Format::assemble(MemBuf &mb, AccessLogEntry *al, int logSequenceNumber)
             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();
diff --git a/src/format/Token.cc b/src/format/Token.cc
index 6859e0a..8a8e5e7 100644
--- a/src/format/Token.cc
+++ b/src/format/Token.cc
@@ -116,6 +116,7 @@ static TokenTableEntry TokenTable2C[] = {
     {"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},