httpd: Configurable index page

Denys Vlasenko vda.linux at googlemail.com
Sat Dec 29 02:16:30 UTC 2007


On Thursday 27 December 2007 20:19, Peter Korsgaard wrote:
> Repost.
>
> Make index page (E.G. index.html) used when a directory is requested
> configurable in httpd.conf with the following syntax:
>
> I:index.xml # use index.xml instead of index.html as index page
>
> ./scripts/bloat-o-meter /tmp/busybox_{old,new}
> function                                             old     new   delta
> parse_conf                                          1262    1290     +28
> httpd_main                                           630     651     +21
> handle_incoming_and_exit                            2093    2105     +12
> send_headers                                         612     618      +6
> ---------------------------------------------------------------------------
>--- (add/remove: 0/0 grow/shrink: 4/0 up/down: 67/0)               Total: 67
> bytes
>
> ---
>  networking/httpd.c |   11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> Index: busybox/networking/httpd.c
> ===================================================================
> --- busybox.orig/networking/httpd.c
> +++ busybox/networking/httpd.c
> @@ -43,6 +43,7 @@
>   * A:127.0.0.1       # Allow local loopback connections
>   * 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
> *
>   * P:/url:[http://]hostname[:port]/new/path
>   *                   # When /urlXXXXXX is requested, reverse proxy
> @@ -250,6 +251,7 @@
>  	const char *g_query;
>  	const char *configFile;
>  	const char *home_httpd;
> +	const char *index_page;
>
>  	const char *found_mime_type;
>  	const char *found_moved_temporarily;
> @@ -295,6 +297,7 @@
>  #define g_query           (G.g_query          )
>  #define configFile        (G.configFile       )
>  #define home_httpd        (G.home_httpd       )
> +#define index_page        (G.index_page       )
>  #define found_mime_type   (G.found_mime_type  )
>  #define found_moved_temporarily (G.found_moved_temporarily)
>  #define last_mod          (G.last_mod         )
> @@ -688,6 +691,9 @@
>  		}
>  #endif
>
> +		if (*p0 == 'I')
> +			index_page = xstrdup(c);
> +

I think you forgot "continue" here.

Patch is applied, thanks.
--
vda



More information about the busybox mailing list