# HG changeset patch # User Pascal Bellard # Date 1302433997 -7200 # Node ID 156116e8b1c30fd76c8516ff9bb7543e317b5e64 # Parent 04815ab9b79d2c1534de75e60ebb41c4beb37fdb busybox/httpd: no patch need for directory list diff -r 04815ab9b79d -r 156116e8b1c3 busybox/receipt --- a/busybox/receipt Sun Apr 10 12:08:35 2011 +0000 +++ b/busybox/receipt Sun Apr 10 13:13:17 2011 +0200 @@ -28,7 +28,6 @@ printable.u cmdline.u conspy.u -httpd.u EOT cp $stuff/$PACKAGE-${VERSION%.*}.config .config } diff -r 04815ab9b79d -r 156116e8b1c3 busybox/stuff/busybox-1.18-httpd.u --- a/busybox/stuff/busybox-1.18-httpd.u Sun Apr 10 12:08:35 2011 +0000 +++ b/busybox/stuff/busybox-1.18-httpd.u Sun Apr 10 13:13:17 2011 +0200 @@ -1,18 +1,15 @@ -This patch allows to run a script to list the directory with httpd +Httpd already support directory listing: -Install /etc/httpd.conf, /var/www/cgi-bin/list.sh and try ! +Install /etc/httpd.conf, /var/www/cgi-bin/index.cgi and try ! ===>8=== /etc/httpd.conf ===>8=== H:/var/www -*.sh:/bin/sh -L:/cgi-bin/list.sh -===>8=== /var/www/cgi-bin/list.sh ===>8=== +===>8=== /var/www/cgi-bin/index.cgi ===>8=== #!/bin/sh -eval ${QUERY_STRING/&/;} -path=$(dirname /$url) +path=$QUERY_STRING -unix2dos < @@ -23,84 +20,9 @@

Index of $path

EOT -===>8======>8======>8======>8======>8=== - ---- busybox-1.18.4/networking/Config.src -+++ busybox-1.18.4/networking/Config.src -@@ -216,6 +216,14 @@ - This option allows scripts and executables to be invoked - when specific URLs are requested. - -+config FEATURE_HTTPD_LISTING -+ bool "Support for directory listing through a CGI script" -+ default y -+ depends on FEATURE_HTTPD_CGI -+ help -+ This option allows to run a script to list the directory -+ content. -+ - config FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR - bool "Support for running scripts through an interpreter" - default y - ---- busybox-1.18.4/networking/httpd.c -+++ busybox-1.18.4/networking/httpd.c -@@ -42,6 +42,7 @@ - * D:* # Deny from other IP connections - * E404:/path/e404.html # /path/e404.html is the 404 (not found) error page - * I:index.html # Show index.html when a directory is requested -+ * L:/path/list # List directory file from $url and $home arguments - * - * P:/url:[http://]hostname[:port]/new/path - * # When /urlXXXXXX is requested, reverse proxy -@@ -240,6 +241,7 @@ - const char *opt_c_configFile; - const char *home_httpd; - const char *index_page; -+ const char *listing; - - const char *found_mime_type; - const char *found_moved_temporarily; -@@ -291,6 +293,7 @@ - #define opt_c_configFile (G.opt_c_configFile ) - #define home_httpd (G.home_httpd ) - #define index_page (G.index_page ) -+#define listing (G.listing ) - #define found_mime_type (G.found_mime_type ) - #define found_moved_temporarily (G.found_moved_temporarily) - #define last_mod (G.last_mod ) -@@ -579,6 +582,13 @@ - continue; - } - -+#if ENABLE_FEATURE_HTTPD_LISTING -+ if (flag == FIRST_PARSE && ch == 'L') { -+ listing = xstrdup(after_colon); -+ continue; -+ } -+#endif -+ - /* do not allow jumping around using H in subdir's configs */ - if (flag == FIRST_PARSE && ch == 'H') { - home_httpd = xstrdup(after_colon); -@@ -1531,6 +1541,13 @@ - fd = open(url, O_RDONLY); - } - if (fd < 0) { -+#if ENABLE_FEATURE_HTTPD_LISTING -+ if (listing) { -+ char args[BUF_SIZE]; -+ snprintf(g_query = args, sizeof(args), "url=%s&home=%s", url, home_httpd); -+ send_cgi_and_exit(listing, "GET", 0, NULL, NULL); -+ } -+#endif - if (DEBUG) - bb_perror_msg("can't open '%s'", url); - /* Error pages are sent by using send_file_and_exit(SEND_BODY). -