You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jayaram A <ja...@wipinfo.soft.net> on 1999/10/27 10:58:10 UTC

[PATCH] for indexing problem in 1.3.9 mod_autoindex module.

Hello All,

Please comment on the below fixes for 2 problems in mod_autoindex module.

-----------------------------------------------------------------------

mod_autoindex Problem 1:
------------------------

AddIcon (<alttext>,<icon>) ^^DIRECTORY^^ 
and 
AddIcon (<alttext>,<icon>) ^^BLANKICON^^ 
should be able to set the alternate text and icon file for any directory/
blankicon in a directory listing. This was not happening because the
alternate text for ^^DIRECTORY^^ and ^^BLANKICON^^ were hardcoded to 
"DIR" and "   " respectively.

For example:

I have done the following setup:

Ran the following 2 commands:

/bin/rm -f <DocumentRoot>/index/testdir
mkdir -p <DocumentRoot>/index/testdir

added the following 2 lines to httpd.conf:

IndexOptions FancyIndexing
AddIcon (alt_txt_for_dir,/icons/folder.gif) ^^DIRECTORY^^

and sent the following HTTP request to the apache HTTP server:

GET /index/ HTTP/1.1
Host: <some_host>
<CRLF>

Now, with  1.3.9 apache, it is observed that the HTML tag entry for 
the directory (that is created, namely "testdir") looks as follows:

<IMG SRC="/icons/folder.gif" ALT="[DIR]"> <A HREF="testdir/">testdir/</A>

where as it should ideally be:

<IMG SRC="/icons/folder.gif" ALT="[alt_txt_for_dir]"> <A HREF="testdir/">testdir/</A>


mod_autoindex Problem 2:
-------------------------

IndexIgnore <file-extension> should hide the files with this file-
extension in directory listings. This was NOT happening because the 
total filename was being compared with the file-extension.


For example:

I have done the following setup:

Ran the following 2 commands:

/bin/rm -rf <DocumentRoot>/index/
mkdir -p <DocumentRoot>/index/
touch <DocumentRoot>/index/textfile.txt
touch <DocumentRoot>/index/testfile.html

added the following line to httpd.conf:

IndexIgnore .txt

and sent the following HTTP request to the apache HTTP server:

GET /index/ HTTP/1.1
Host: <some_host>
<CRLF>

Now, with 1.3.9 apache, it is observed that the generated HTML file
also lists the textfile.txt as below: 

<A HREF="textfile.txt">textfile.txt</A>

where as it is not exepected to list testfile.txt.

The attachment listing the fix for the above problems: mod_autoindex.c.diffs

(diff -C 3 apache_1.3.9/src/modules/standard/mod_autoindex.c.org  \
           apache_1.3.9/src/modules/standard/mod_autoindex.c.new)

--------------------------------------------------------------------------

Thanks and Regards,
Jayaram.

Re: [PATCH] for indexing problem in 1.3.9 mod_autoindex module.

Posted by Manoj Kasichainula <ma...@io.com>.
untested, but it seems reasonable (yet another module I don't mess
with, though). I'm curious about one thing, though:

On Wed, Oct 27, 1999 at 02:28:10PM +0530, Jayaram A wrote:
> --- 1312,1321 ----
>   
>       if (autoindex_opts & FANCY_INDEXING) {
>   	ap_rputs("<PRE>", r);
> !     if ((tp = find_default_icon(d, "^^BLANKICON^^")) &&
> !         (altp = find_default_alt(d, "^^BLANKICON^^"))) {
> !         ap_rvputs(r, "<IMG SRC=\"", ap_escape_html(scratch, tp),
> !            "\" ALT=\"[", (altp ? altp : "   "), "]\"",  NULL);

Doesn't altp have to be nonnull here, because of the if statement?
Then the altp ? altp :  "   " shouldn't be necessary, or am I missing
something?

-- 
Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/