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
|
===================================================================
RCS file: /home/cvspublic/apache-1.3/src/modules/standard/mod_usertrack.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- apache-1.3/src/modules/standard/mod_usertrack.c 2004/01/13 10:22:44 1.59
+++ apache-1.3/src/modules/standard/mod_usertrack.c 2004/01/13 13:47:34 1.60
@@ -286,10 +286,29 @@
return;
}
-/* dcfg->regexp is "^cookie_name=([^;]+)|;[ \t]+cookie_name=([^;]+)",
- * which has three subexpressions, $0..$2 */
+/*
+ * dcfg->regexp is "^cookie_name=([^;]+)|;[ \t]+cookie_name=([^;]+)",
+ * which has three subexpressions, $0..$2
+ */
#define NUM_SUBS 3
+static void set_and_comp_regexp(cookie_dir_rec *dcfg,
+ pool *p,
+ const char *cookie_name)
+{
+ /*
+ * The goal is to end up with this regexp,
+ * ^cookie_name=([^;]+)|;[\t]+cookie_name=([^;]+)
+ * with cookie_name obviously substituted either
+ * with the real cookie name set by the user in httpd.conf,
+ * or with the default COOKIE_NAME.
+ */
+ dcfg->regexp_string = ap_pstrcat(p, "^", cookie_name,
+ "=([^;]+)|;[ \t]+", cookie_name,
+ "=([^;]+)", NULL);
+ dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED);
+}
+
static int spot_cookie(request_rec *r)
{
cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config,
@@ -352,6 +371,11 @@
dcfg->style = CT_UNSET;
dcfg->format = CF_NORMAL;
dcfg->enabled = 0;
+ /*
+ * In case the user does not use the CookieName directive,
+ * we need to compile the regexp for the default cookie name.
+ */
+ set_and_comp_regexp(dcfg, p, COOKIE_NAME);
return dcfg;
}
@@ -436,18 +460,10 @@
{
cookie_dir_rec *dcfg = (cookie_dir_rec *) mconfig;
- /* The goal is to end up with this regexp,
- * ^cookie_name=([^;]+)|;[ \t]+cookie_name=([^;]+)
- * with cookie_name
- * obviously substituted with the real cookie name set by the
- * user in httpd.conf. */
- dcfg->regexp_string = ap_pstrcat(cmd->pool, "^", name,
- "=([^;]+)|;[ \t]+", name,
- "=([^;]+)", NULL);
-
dcfg->cookie_name = ap_pstrdup(cmd->pool, name);
- dcfg->regexp = ap_pregcomp(cmd->pool, dcfg->regexp_string, REG_EXTENDED);
+ set_and_comp_regexp(dcfg, cmd->pool, name);
+
if (dcfg->regexp == NULL) {
return "Regular expression could not be compiled.";
}
|