Hi, All
I have such lines in my mathopd.conf
========================
...
Control {
RunScriptsAsOwner On
...
...
AutoIndexCommand /usr/local/www/cgi-bin/web_ls
# AutoIndexCommand /usr/local/www/cgi-bin/dir_cgi
}
Server {
Virtual {
AnyHost
Control {
Alias /
Location /usr/local/www
}
Control {
Alias /alex
Location /home/alex/www
}
}
}
========================
Where web_ls is a very simple sh-script file that I've written for
directory listings (its source is at the end of the text).
It's works OK on URL's as
/http://medieval/alex/abc/
/http://medieval/alex/abc/def
/http://medieval/xyz
/http://medieval/xyz/qwe (and so on)
(medieval - it is my hostname)
but on this URL's
/http://medieval/alex/
/http://medieval/
browser (in my case - links or Konqueror) prompts to download this
script as 'application/octet-stream'!! (a sample cgi program dir_cgi
that provided on the mathopd site works fine at all kind of URL's)
web_ls source:
========================
#!/bin/sh
cat << EOF
Cache-Control: max-age=900
Content-type: text/html
<html>
<head>
<title>$(pwd)</title>
</head>
<body>
PWD: $(pwd)<br>
PATH_INFO: $PATH_INFO
<pre>
EOF
fileinfo=$(ls -lFa | sed '1,2d' | sed -E 's/(..:..)(.*)/\1/')
filelist=$(ls -Fa | sed '1d')
IFS='
'
c=$(printf "$filelist\n" | wc -l)
for i in $fileinfo
do
c=$(($c-1))
for j in $filelist
do
printf '%s ' $i
printf '<b><a href="%s">%s</a></b>\n' $j $j
break
done
filelist=$(printf "$filelist" | tail -n $c)
done
cat << EOF
</pre>
$SERVER_SOFTWARE
</body>
</html>
EOF
========================
Sorry for my terrible english
-Alex'a X Spirit-