View | Details | Raw Unified | Return to bug 11294
Collapse All | Expand All

(-)httpd-2.0.48.orig/modules/mappers/mod_vhost_alias.c (-7 / +26 lines)
Lines 107-112 Link Here
107
typedef struct mva_sconf_t {
107
typedef struct mva_sconf_t {
108
    const char *doc_root;
108
    const char *doc_root;
109
    const char *cgi_root;
109
    const char *cgi_root;
110
    const char *unset_part;
111
    int unset_part_len;
110
    mva_mode_e doc_root_mode;
112
    mva_mode_e doc_root_mode;
111
    mva_mode_e cgi_root_mode;
113
    mva_mode_e cgi_root_mode;
112
} mva_sconf_t;
114
} mva_sconf_t;
Lines 118-123 Link Here
118
    conf = (mva_sconf_t *) apr_pcalloc(p, sizeof(mva_sconf_t));
120
    conf = (mva_sconf_t *) apr_pcalloc(p, sizeof(mva_sconf_t));
119
    conf->doc_root = NULL;
121
    conf->doc_root = NULL;
120
    conf->cgi_root = NULL;
122
    conf->cgi_root = NULL;
123
    conf->unset_part = "_";
124
    conf->unset_part_len = 1;
121
    conf->doc_root_mode = VHOST_ALIAS_UNSET;
125
    conf->doc_root_mode = VHOST_ALIAS_UNSET;
122
    conf->cgi_root_mode = VHOST_ALIAS_UNSET;
126
    conf->cgi_root_mode = VHOST_ALIAS_UNSET;
123
    return conf;
127
    return conf;
Lines 254-259 Link Here
254
    return NULL;
258
    return NULL;
255
}
259
}
256
260
261
static const char *vhost_alias_set_part(cmd_parms *cmd, void *dummy,
262
					const char *unset_part)
263
{
264
    mva_sconf_t *conf;
265
    conf = (mva_sconf_t *) ap_get_module_config(cmd->server->module_config,
266
						&vhost_alias_module);
267
    conf->unset_part = unset_part;
268
    conf->unset_part_len = strlen(unset_part);
269
    return NULL;
270
}
271
257
static const command_rec mva_commands[] =
272
static const command_rec mva_commands[] =
258
{
273
{
259
    AP_INIT_TAKE1("VirtualScriptAlias", vhost_alias_set, 
274
    AP_INIT_TAKE1("VirtualScriptAlias", vhost_alias_set, 
Lines 268-273 Link Here
268
    AP_INIT_TAKE1("VirtualDocumentRootIP", vhost_alias_set, 
283
    AP_INIT_TAKE1("VirtualDocumentRootIP", vhost_alias_set, 
269
                  &vhost_alias_set_doc_root_ip, RSRC_CONF, 
284
                  &vhost_alias_set_doc_root_ip, RSRC_CONF, 
270
                  "how to create the DocumentRoot based on the host"),
285
                  "how to create the DocumentRoot based on the host"),
286
    AP_INIT_TAKE1("VirtualUnsetPart", vhost_alias_set_part,
287
                  NULL, RSRC_CONF,
288
                  "how to set the unset part"),
271
    { NULL }
289
    { NULL }
272
};
290
};
273
291
Lines 292-299 Link Here
292
    }
310
    }
293
}
311
}
294
312
295
static void vhost_alias_interpolate(request_rec *r, const char *name,
313
static void vhost_alias_interpolate(request_rec *r, mva_sconf_t *conf,
296
				    const char *map, const char *uri)
314
				    const char *name, const char *map,
315
				    const char *uri)
297
{
316
{
298
    /* 0..9 9..0 */
317
    /* 0..9 9..0 */
299
    enum { MAXDOTS = 19 };
318
    enum { MAXDOTS = 19 };
Lines 369-376 Link Here
369
	end = dots[ndots]; /* ptr to the character after the last one */
388
	end = dots[ndots]; /* ptr to the character after the last one */
370
	if (N != 0) {
389
	if (N != 0) {
371
	    if (N > ndots) {
390
	    if (N > ndots) {
372
		start = "_";
391
		start = conf->unset_part;
373
		end = start+1;
392
		end = start+conf->unset_part_len;
374
	    }
393
	    }
375
	    else if (!Nd) {
394
	    else if (!Nd) {
376
		start = dots[N-1]+1;
395
		start = dots[N-1]+1;
Lines 387-394 Link Here
387
	}
406
	}
388
	if (M != 0) {
407
	if (M != 0) {
389
	    if (M > end - start) {
408
	    if (M > end - start) {
390
		start = "_";
409
		start = conf->unset_part;
391
		end = start+1;
410
		end = start+conf->unset_part_len;
392
	    }
411
	    }
393
	    else if (!Md) {
412
	    else if (!Md) {
394
		start = start+M-1;
413
		start = start+M-1;
Lines 468-474 Link Here
468
     * canonical_path buffer.
487
     * canonical_path buffer.
469
     */
488
     */
470
    r->canonical_filename = "";
489
    r->canonical_filename = "";
471
    vhost_alias_interpolate(r, name, map, uri);
490
    vhost_alias_interpolate(r, conf, name, map, uri);
472
491
473
    if (cgi) {
492
    if (cgi) {
474
	/* see is_scriptaliased() in mod_cgi */
493
	/* see is_scriptaliased() in mod_cgi */

Return to bug 11294