--- httpd-2.0.48.orig/modules/mappers/mod_vhost_alias.c 2003-02-03 18:31:45.000000000 +0100 +++ httpd-2.0.48.orig/modules/mappers/mod_vhost_alias.c 2004-02-21 15:00:53.000000000 +0100 @@ -107,6 +107,8 @@ typedef struct mva_sconf_t { const char *doc_root; const char *cgi_root; + const char *unset_part; + int unset_part_len; mva_mode_e doc_root_mode; mva_mode_e cgi_root_mode; } mva_sconf_t; @@ -118,6 +120,8 @@ conf = (mva_sconf_t *) apr_pcalloc(p, sizeof(mva_sconf_t)); conf->doc_root = NULL; conf->cgi_root = NULL; + conf->unset_part = "_"; + conf->unset_part_len = 1; conf->doc_root_mode = VHOST_ALIAS_UNSET; conf->cgi_root_mode = VHOST_ALIAS_UNSET; return conf; @@ -254,6 +258,17 @@ return NULL; } +static const char *vhost_alias_set_part(cmd_parms *cmd, void *dummy, + const char *unset_part) +{ + mva_sconf_t *conf; + conf = (mva_sconf_t *) ap_get_module_config(cmd->server->module_config, + &vhost_alias_module); + conf->unset_part = unset_part; + conf->unset_part_len = strlen(unset_part); + return NULL; +} + static const command_rec mva_commands[] = { AP_INIT_TAKE1("VirtualScriptAlias", vhost_alias_set, @@ -268,6 +283,9 @@ AP_INIT_TAKE1("VirtualDocumentRootIP", vhost_alias_set, &vhost_alias_set_doc_root_ip, RSRC_CONF, "how to create the DocumentRoot based on the host"), + AP_INIT_TAKE1("VirtualUnsetPart", vhost_alias_set_part, + NULL, RSRC_CONF, + "how to set the unset part"), { NULL } }; @@ -292,8 +310,9 @@ } } -static void vhost_alias_interpolate(request_rec *r, const char *name, - const char *map, const char *uri) +static void vhost_alias_interpolate(request_rec *r, mva_sconf_t *conf, + const char *name, const char *map, + const char *uri) { /* 0..9 9..0 */ enum { MAXDOTS = 19 }; @@ -369,8 +388,8 @@ end = dots[ndots]; /* ptr to the character after the last one */ if (N != 0) { if (N > ndots) { - start = "_"; - end = start+1; + start = conf->unset_part; + end = start+conf->unset_part_len; } else if (!Nd) { start = dots[N-1]+1; @@ -387,8 +406,8 @@ } if (M != 0) { if (M > end - start) { - start = "_"; - end = start+1; + start = conf->unset_part; + end = start+conf->unset_part_len; } else if (!Md) { start = start+M-1; @@ -468,7 +487,7 @@ * canonical_path buffer. */ r->canonical_filename = ""; - vhost_alias_interpolate(r, name, map, uri); + vhost_alias_interpolate(r, conf, name, map, uri); if (cgi) { /* see is_scriptaliased() in mod_cgi */