You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rasmus Lerdorf <ra...@lerdorf.on.ca> on 1997/06/25 05:37:15 UTC
Very strange bug in mod_dir
I have the following .htaccess file in a directory:
AddDescription "Hanne Boel - Silent Violence" silent.mp3
AddDescription "Hanne Boel - Soundtrack of a Night" night.mp3
AddDescription "Hanne Boel - Broken Angel" angel.mp3
AddDescription "Hanne Boel - Song of the Land" land.mp3
AddDescription "Hanne Boel - What a Woman Sees" woman.mp3
AddDescription "Sanne Salomonsen - Hende Eller Mig" hende.mp3
AddDescription "Pulp Fiction" pahb.mp3
AddDescription "Frente! - Girl" girl.mp3
AddDescription "Frente! - Burning Girl" burngirl.mp3
When I hit the page, I get:
Parent Directory 23-Jun-97 11:16 -
angel.mp3 21-Jun-97 21:45 3.9M Hanne Boel - Broken An>
burngirl.mp3 21-Jun-97 19:56 2.4M Frente! - Girl
girl.mp3 23-Jun-97 23:55 2.5M Frente! - Girl
hende.mp3 22-Jun-97 12:56 5.0M Sanne Salomonsen - Hen>
land.mp3 21-Jun-97 22:20 3.6M Hanne Boel - Song of t>
night.mp3 21-Jun-97 20:52 5.2M Hanne Boel - Soundtrac>
pahb.mp3 24-Jun-97 13:50 2.3M Pulp Fiction
silent.mp3 21-Jun-97 19:58 5.2M Hanne Boel - Silent Vi>
woman.mp3 22-Jun-97 00:36 4.2M Hanne Boel - What a Wo>
Note the repeated "Frente! - Girl" description. How the heck did that
happen? If I flip the order of the last two lines in the .htaccess, the
output is correct.
I have been hunting through the mod_dir.c code for this one, but I don't
see it.
-Rasmus
Re: Very strange bug in mod_dir
Posted by Marc Slemko <ma...@worldgate.com>.
mod_dir does "partial matches". Since it doesn't document exactly what it
means by that, its behavior doesn't disagree with the docs; burngirl.mp3
is matched by the partial string girl.mp3.
My suggestion would be that girl.mp3 should match only girl.mp3, while
.mp3 should still match *.mp3.
A sample patch that does this is included below, but I don't entirely like
it. I haven't yet decided how much of that is due to the way I wrote the
patch and how much is due to the way mod_dir works.
Index: mod_dir.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_dir.c,v
retrieving revision 1.28
diff -c -r1.28 mod_dir.c
*** mod_dir.c 1997/06/17 00:09:14 1.28
--- mod_dir.c 1997/06/25 04:26:01
***************
*** 121,127 ****
p->apply_path = pstrcat(arr->pool, path, "*", NULL);
if((type == BY_PATH) && (!is_matchexp(to)))
! p->apply_to = pstrcat (arr->pool, "*", to, NULL);
else if (to)
p->apply_to = pstrdup (arr->pool, to);
else
--- 121,130 ----
p->apply_path = pstrcat(arr->pool, path, "*", NULL);
if((type == BY_PATH) && (!is_matchexp(to)))
! if (*to == '.')
! p->apply_to = pstrcat (arr->pool, "*", to, NULL);
! else
! p->apply_to = pstrcat (arr->pool, "*/", to, NULL);
else if (to)
p->apply_to = pstrdup (arr->pool, to);
else
On Tue, 24 Jun 1997, Rasmus Lerdorf wrote:
> I have the following .htaccess file in a directory:
>
> AddDescription "Hanne Boel - Silent Violence" silent.mp3
> AddDescription "Hanne Boel - Soundtrack of a Night" night.mp3
> AddDescription "Hanne Boel - Broken Angel" angel.mp3
> AddDescription "Hanne Boel - Song of the Land" land.mp3
> AddDescription "Hanne Boel - What a Woman Sees" woman.mp3
> AddDescription "Sanne Salomonsen - Hende Eller Mig" hende.mp3
> AddDescription "Pulp Fiction" pahb.mp3
> AddDescription "Frente! - Girl" girl.mp3
> AddDescription "Frente! - Burning Girl" burngirl.mp3
>
> When I hit the page, I get:
>
> Parent Directory 23-Jun-97 11:16 -
> angel.mp3 21-Jun-97 21:45 3.9M Hanne Boel - Broken An>
> burngirl.mp3 21-Jun-97 19:56 2.4M Frente! - Girl
> girl.mp3 23-Jun-97 23:55 2.5M Frente! - Girl
> hende.mp3 22-Jun-97 12:56 5.0M Sanne Salomonsen - Hen>
> land.mp3 21-Jun-97 22:20 3.6M Hanne Boel - Song of t>
> night.mp3 21-Jun-97 20:52 5.2M Hanne Boel - Soundtrac>
> pahb.mp3 24-Jun-97 13:50 2.3M Pulp Fiction
> silent.mp3 21-Jun-97 19:58 5.2M Hanne Boel - Silent Vi>
> woman.mp3 22-Jun-97 00:36 4.2M Hanne Boel - What a Wo>
>
> Note the repeated "Frente! - Girl" description. How the heck did that
> happen? If I flip the order of the last two lines in the .htaccess, the
> output is correct.
>
> I have been hunting through the mod_dir.c code for this one, but I don't
> see it.
>
> -Rasmus
>