wok view busybox/stuff/busybox-1.18-httpd.u @ rev 9552

busybox/httpd: no patch need for directory list
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Apr 10 13:13:17 2011 +0200 (2011-04-10)
parents 3dc7c4a7f5ef
children ab162b37b187
line source
1 Httpd already support directory listing:
3 Install /etc/httpd.conf, /var/www/cgi-bin/index.cgi and try !
5 ===>8=== /etc/httpd.conf ===>8===
6 H:/var/www
7 ===>8=== /var/www/cgi-bin/index.cgi ===>8===
8 #!/bin/sh
10 path=$QUERY_STRING
12 cat <<EOT
13 Content-type: text/html
15 <!DOCTYPE html>
16 <html xmlns="http://www.w3.org/1999/xhtml">
17 <head>
18 <title>Index of $path</title>
19 </head>
20 <body>
21 <h1>Index of $path</h1>
22 <ul>
23 $(cd ${PWD/?index.cgi/}$path && { [ "$path" != "/" ] && echo "../"; ls -p; } | \
24 sed 's|.*| <li><a href="&">&</a></li>|')
25 </ul>
26 </body>
27 </html>
28 EOT