summaryrefslogtreecommitdiff
path: root/modules/mappers/mod_rewrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mappers/mod_rewrite.c')
-rw-r--r--modules/mappers/mod_rewrite.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c
index 9823a7fa..4fa90546 100644
--- a/modules/mappers/mod_rewrite.c
+++ b/modules/mappers/mod_rewrite.c
@@ -191,6 +191,7 @@ static const char* really_last_key = "rewrite_really_last";
#define OPTION_INHERIT_BEFORE 1<<2
#define OPTION_NOSLASH 1<<3
#define OPTION_ANYURI 1<<4
+#define OPTION_MERGEBASE 1<<5
#ifndef RAND_MAX
#define RAND_MAX 32767
@@ -1402,9 +1403,10 @@ static char *lookup_map_program(request_rec *r, apr_file_t *fpin,
/* write out the request key */
#ifdef NO_WRITEV
nbytes = strlen(key);
- apr_file_write(fpin, key, &nbytes);
+ /* XXX: error handling */
+ apr_file_write_full(fpin, key, nbytes, NULL);
nbytes = 1;
- apr_file_write(fpin, "\n", &nbytes);
+ apr_file_write_full(fpin, "\n", nbytes, NULL);
#else
iova[0].iov_base = key;
iova[0].iov_len = strlen(key);
@@ -1412,7 +1414,8 @@ static char *lookup_map_program(request_rec *r, apr_file_t *fpin,
iova[1].iov_len = 1;
niov = 2;
- apr_file_writev(fpin, iova, niov, &nbytes);
+ /* XXX: error handling */
+ apr_file_writev_full(fpin, iova, niov, &nbytes);
#endif
buf = apr_palloc(r->pool, REWRITE_PRG_MAP_BUF + 1);
@@ -2821,8 +2824,14 @@ static void *config_perdir_merge(apr_pool_t *p, void *basev, void *overridesv)
a->state_set = overrides->state_set || base->state_set;
a->options = (overrides->options_set == 0) ? base->options : overrides->options;
a->options_set = overrides->options_set || base->options_set;
- a->baseurl = (overrides->baseurl_set == 0) ? base->baseurl : overrides->baseurl;
- a->baseurl_set = overrides->baseurl_set || base->baseurl_set;
+
+ if (a->options & OPTION_MERGEBASE) {
+ a->baseurl = (overrides->baseurl_set == 0) ? base->baseurl : overrides->baseurl;
+ a->baseurl_set = overrides->baseurl_set || base->baseurl_set;
+ }
+ else {
+ a->baseurl = overrides->baseurl;
+ }
a->directory = overrides->directory;
@@ -2897,6 +2906,9 @@ static const char *cmd_rewriteoptions(cmd_parms *cmd,
else if (!strcasecmp(w, "allowanyuri")) {
options |= OPTION_ANYURI;
}
+ else if (!strcasecmp(w, "mergebase")) {
+ options |= OPTION_MERGEBASE;
+ }
else {
return apr_pstrcat(cmd->pool, "RewriteOptions: unknown option '",
w, "'", NULL);