Skip to content

Commit 7b12bfc

Browse files
committed
core: Restore original regex value when nesting Location,
Directory and File directives. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909356 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0fab406 commit 7b12bfc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

server/core.c

+14
Original file line numberDiff line numberDiff line change
@@ -2513,6 +2513,7 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
25132513
const char *endp = ap_strrchr_c(arg, '>');
25142514
int old_overrides = cmd->override;
25152515
char *old_path = cmd->path;
2516+
ap_regex_t *old_regex = cmd->regex;
25162517
core_dir_config *conf;
25172518
ap_conf_vector_t *new_dir_conf = ap_create_per_dir_config(cmd->pool);
25182519
const command_rec *thiscmd = cmd->cmd;
@@ -2556,6 +2557,8 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
25562557
int run_mode = ap_state_query(AP_SQ_RUN_MODE);
25572558
char *newpath;
25582559

2560+
cmd->regex = NULL;
2561+
25592562
/*
25602563
* Ensure that the pathname is canonical, and append the trailing /
25612564
*/
@@ -2614,6 +2617,7 @@ static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
26142617

26152618
cmd->path = old_path;
26162619
cmd->override = old_overrides;
2620+
cmd->regex = old_regex;
26172621

26182622
return NULL;
26192623
}
@@ -2624,6 +2628,7 @@ static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg)
26242628
const char *endp = ap_strrchr_c(arg, '>');
26252629
int old_overrides = cmd->override;
26262630
char *old_path = cmd->path;
2631+
ap_regex_t *old_regex = cmd->regex;
26272632
core_dir_config *conf;
26282633
const command_rec *thiscmd = cmd->cmd;
26292634
ap_conf_vector_t *new_url_conf = ap_create_per_dir_config(cmd->pool);
@@ -2658,6 +2663,9 @@ static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg)
26582663
return "Regex could not be compiled";
26592664
}
26602665
}
2666+
else {
2667+
cmd->regex = NULL;
2668+
}
26612669

26622670
/* initialize our config and fetch it */
26632671
conf = ap_set_config_vectors(cmd->server, new_url_conf, cmd->path,
@@ -2685,6 +2693,7 @@ static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg)
26852693

26862694
cmd->path = old_path;
26872695
cmd->override = old_overrides;
2696+
cmd->regex = old_regex;
26882697

26892698
return NULL;
26902699
}
@@ -2695,6 +2704,7 @@ static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg)
26952704
const char *endp = ap_strrchr_c(arg, '>');
26962705
int old_overrides = cmd->override;
26972706
char *old_path = cmd->path;
2707+
ap_regex_t *old_regex = cmd->regex;
26982708
core_dir_config *conf;
26992709
const command_rec *thiscmd = cmd->cmd;
27002710
ap_conf_vector_t *new_file_conf = ap_create_per_dir_config(cmd->pool);
@@ -2736,6 +2746,9 @@ static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg)
27362746
}
27372747
else {
27382748
char *newpath;
2749+
2750+
cmd->regex = NULL;
2751+
27392752
/* Ensure that the pathname is canonical, but we
27402753
* can't test the case/aliases without a fixed path */
27412754
if (apr_filepath_merge(&newpath, "", cmd->path,
@@ -2771,6 +2784,7 @@ static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg)
27712784

27722785
cmd->path = old_path;
27732786
cmd->override = old_overrides;
2787+
cmd->regex = old_regex;
27742788

27752789
return NULL;
27762790
}

0 commit comments

Comments
 (0)