From b12b61df69c37bafefbb35afd8153a6ad12e2acd Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Wed, 3 Jul 2019 12:20:29 +0000 Subject: [PATCH] Merged in masayuki2009/nuttx.apps/fix_webserver (pull request #179) apps/examples/webserver: Fix to compile with CONFIG_NETUTILS_HTTPD_SENDFILE=y Also, in this PR, some configs such as CONFIG_NETUTILS_HTTPDFILESTATS can be selected by menuconfig. Signed-off-by: Masayuki Ishikawa Approved-by: Gregory Nutt --- examples/webserver/webserver_main.c | 2 ++ include/netutils/httpd.h | 12 ------------ netutils/webserver/Kconfig | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/examples/webserver/webserver_main.c b/examples/webserver/webserver_main.c index ac8dd1bc6..11004a5c6 100644 --- a/examples/webserver/webserver_main.c +++ b/examples/webserver/webserver_main.c @@ -189,7 +189,9 @@ int webserver_main(int argc, char *argv[]) #ifdef CONFIG_NET_TCP printf("Starting webserver\n"); httpd_init(); +#ifndef CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE cgi_register(); +#endif httpd_listen(); #endif diff --git a/include/netutils/httpd.h b/include/netutils/httpd.h index eb51a46f3..cd53e756d 100644 --- a/include/netutils/httpd.h +++ b/include/netutils/httpd.h @@ -63,18 +63,6 @@ # define CONFIG_NETUTILS_HTTPDSTACKSIZE 4096 #endif -#ifndef CONFIG_NETUTILS_HTTPDFSSTATS -# define CONFIG_NETUTILS_HTTPDFSSTATS -#endif - -#ifndef CONFIG_NETUTILS_HTTPDFILESTATS -# define CONFIG_NETUTILS_HTTPDFILESTATS -#endif - -#ifndef CONFIG_NET_STATISTICS -# undef CONFIG_NETUTILS_HTTPDNETSTATS -#endif - /* For efficiency reasons, the size of the IO buffer should be a multiple * of the TCP MSS value. Also, the current design requires that the IO * buffer be sufficiently large to contain the entire GET request. diff --git a/netutils/webserver/Kconfig b/netutils/webserver/Kconfig index 078ed8acb..e37d331ec 100644 --- a/netutils/webserver/Kconfig +++ b/netutils/webserver/Kconfig @@ -158,4 +158,19 @@ config NETUTILS_HTTPD_KEEPALIVE_DISABLE Keep-alive should normally be disabled if timeouts are enabled, otherwise a rogue HTTP client could block the httpd indefinitely. +config NETUTILS_HTTPDFILESTATS + bool "Show file stats" + depends on !NETUTILS_HTTPD_SCRIPT_DISABLE + default y + +config NETUTILS_HTTPDFSSTATS + bool "Show fs stats" + depends on !NETUTILS_HTTPD_SCRIPT_DISABLE + default y + +config NETUTILS_HTTPDNETSTATS + bool "Show net stats" + depends on !NETUTILS_HTTPD_SCRIPT_DISABLE && NET_STATISTICS + default y + endif # NETUTILS_WEBSERVER