On Mon, 6 Jul 2020 00:12:41 +0300 Sergey Ponomarev <stok...@gmail.com> wrote:
> This is an old topic where Pascal proposed a patch that allows to run a > script to list the directory with httpd > http://hg.slitaz.org/wok/raw-file/3dc7c4a7f5ef/busybox/stuff/busybox-1.18-httpd.u > > > > > Denys said: > > This is already supported: > > * If directory URL is given, no index.html is found and CGI support > is enabled, > > * cgi-bin/index.cgi will be run. Directory to list is ../$QUERY_STRING. > > * See httpd_indexcgi.c for an example GCI code. > > > But I still don't get a clue how to see the directory listing. @Denys > could you elaborate on this or add more details into the comment in > httpd_indexcgi.c? Works or me: $ egrep "(HTTPD=|HTTPD_CGI)" .config CONFIG_HTTPD=y CONFIG_FEATURE_HTTPD_CGI=y $ make $ mkdir /tmp/www/{,cgi-bin,html,html/foo} $ ./busybox httpd -f -p 8080 -h /tmp/www/ & $ gcc -o /tmp/www/cgi-bin/index.cgi networking/httpd_indexcgi.c -static -static-libgcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Os -fno-builtin -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 $ ./busybox wget -q -O - 127.0.0.1:8080 <html><head><title>Index of /</title> <style> table { width:100%; background-color:#fff5ee; border-width:1px; border-spacing:2px; .... _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox