]>
Commit | Line | Data |
---|---|---|
0e467b1f AM |
1 | |
2 | mod_usertrack fix from Manni Wood <manniwood planet-save.com> | |
3 | ||
4 | http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=113269 | |
5 | ||
6 | --- httpd-2.0.48/modules/metadata/mod_usertrack.c.usertrack | |
7 | +++ httpd-2.0.48/modules/metadata/mod_usertrack.c | |
8 | @@ -199,6 +199,20 @@ | |
9 | * which has three subexpressions, $0..$2 */ | |
10 | #define NUM_SUBS 3 | |
11 | ||
12 | +static void set_and_comp_regexp(cookie_dir_rec *dcfg, | |
13 | + apr_pool_t *p, | |
14 | + const char *cookie_name) | |
15 | +{ | |
16 | + /* The goal is to end up with this regexp, | |
17 | + * ^cookie_name=([^;]+)|;[\t]+cookie_name=([^;]+) | |
18 | + * with cookie_name obviously substituted either | |
19 | + * with the real cookie name set by the user in httpd.conf, or with the | |
20 | + * default COOKIE_NAME. */ | |
21 | + dcfg->regexp_string = apr_pstrcat(p, "^", cookie_name, "=([^;]+)|;[ \t]+", cookie_name, "=([^;]+)", NULL); | |
22 | + | |
23 | + dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED); | |
24 | +} | |
25 | + | |
26 | static int spot_cookie(request_rec *r) | |
27 | { | |
28 | cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config, | |
29 | @@ -260,6 +274,11 @@ | |
30 | dcfg->cookie_domain = NULL; | |
31 | dcfg->style = CT_UNSET; | |
32 | dcfg->enabled = 0; | |
33 | + | |
34 | + /* In case the user does not use the CookieName directive, | |
35 | + * we need to compile the regexp for the default cookie name. */ | |
36 | + set_and_comp_regexp(dcfg, p, COOKIE_NAME); | |
37 | + | |
38 | return dcfg; | |
39 | } | |
40 | ||
41 | @@ -345,18 +364,10 @@ | |
42 | { | |
43 | cookie_dir_rec *dcfg = (cookie_dir_rec *) mconfig; | |
44 | ||
45 | - /* The goal is to end up with this regexp, | |
46 | - * ^cookie_name=([^;]+)|;[ \t]+cookie_name=([^;]+) | |
47 | - * with cookie_name | |
48 | - * obviously substituted with the real cookie name set by the | |
49 | - * user in httpd.conf. */ | |
50 | - dcfg->regexp_string = apr_pstrcat(cmd->pool, "^", name, | |
51 | - "=([^;]+)|;[ \t]+", name, | |
52 | - "=([^;]+)", NULL); | |
53 | - | |
54 | dcfg->cookie_name = apr_pstrdup(cmd->pool, name); | |
55 | ||
56 | - dcfg->regexp = ap_pregcomp(cmd->pool, dcfg->regexp_string, REG_EXTENDED); | |
57 | + set_and_comp_regexp(dcfg, cmd->pool, name); | |
58 | + | |
59 | if (dcfg->regexp == NULL) { | |
60 | return "Regular expression could not be compiled."; | |
61 | } |