httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eli Marmor <>
Subject Making "_" of mod_vhost_alias.c Configurable
Date Thu, 25 Sep 2003 14:23:41 GMT

When the "%N" or "%-N" of VirtualDocumentRoot (or one of its friends)
in mod_vhost_alias.c doesn't exist, mod_vhost_alias.c puts "_" instead
of it.

I want to add a directive that when being defined, will replace this
"_" by another string, or by an empty string.

An empty string (or ".") can be good for the following case:

You want to allow different domains with different depth of names (i.e.
"" vs. "") to live together, in a
reversed order of directories, i.e. "" under "/var/com/level2"
and "" under "/var/com/levelB/levelC/levelD".

The problem is that there is no condition directive that examines the
NUMBER of levels (let's ignore mod_rewrite and its options...).

So all you can do is:

VirtualDocumentRoot  "/var/%-1/%-2/%-3/%-4"

In the case of "" it's perfect; You get what
you asked for ("/var/com/levelB/levelC/levelD").

However, in the case of "" you get "/var/com/level2/_/_"
(instead of "/var/com/level2").

If it was possible to replace "_" by "" or by ".", you could get what
you wanted.

While it's ugly to replace the "_" in the code, and may break the
compatibility with old versions, an optional directive is elegant.

Such a directive should check that there is no ".." or other hacks in
the string, because sometimes the webmaster gives partial permissions
to the specific webmaster of this specific virtual host, and we don't
want to break the security of the server by letting that sub-webmaster
to reach areas which he shouldn't reach.

My question: if I send a patch, is there any interest in adding it to
the code?
Otherwise, it will be easier for me to replace the "_" in the code.

P.S. the source of the problem is a limitation of the wildcards in
named; you can't define "*" and "*.*", but
only "*". And there is no "?" that means "1-level-wild-
card". So all the names that ends by "" will translate to
the same IP.

Eli Marmor
CTO, Founder
Netmask (El-Mar) Internet Technologies Ltd.
Tel.:   +972-9-766-1020          8 Yad-Harutzim St.
Fax.:   +972-9-766-1314          P.O.B. 7004
Mobile: +972-50-23-7338          Kfar-Saba 44641, Israel

View raw message