This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 8c9e126f91a99d5f14e0ffc07c864be9013aaa45
Author: Tim Hardisty <56726697+tim...@users.noreply.github.com>
AuthorDate: Tue Jul 1 15:03:16 2025 +0100

    netutils/thttpd-fix-broken-CGI-and-fixup-Kconfig
---
 netutils/thttpd/Kconfig    | 16 +++++++++++++---
 netutils/thttpd/libhttpd.c |  4 ++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/netutils/thttpd/Kconfig b/netutils/thttpd/Kconfig
index ad5920670..8d6dec693 100644
--- a/netutils/thttpd/Kconfig
+++ b/netutils/thttpd/Kconfig
@@ -16,7 +16,10 @@ config THTTPD_NFILE_DESCRIPTORS
        int "the maximum number of file descriptors for thttpd webserver"
        default 16
        ---help---
-               The maximum number of file descriptors for thttpd webserver
+               The maximum number of file descriptors for thttpd webserver. 
This is
+               used during CGI application execution to close all file 
descriptors
+               after stdin, stdout and stderr up to and including this value 
(with
+               the exception of file descriptor for the open network socket).
 
 config THTTPD_PORT
        int "THTTPD port number"
@@ -106,6 +109,13 @@ config THTTPD_CGI_TIMELIMIT
                How many seconds to allow CGI programs to run before killing 
them.
                Default: 0 (no time limit)
 
+config THTTPD_CGIDUMP
+       bool "Output Interposed CGI strings to stderr"
+       default n
+       ---help---
+               Enabling this will copy sent to and received from CGI tasks
+               to the stderr device.
+
 config THTTPD_CHARSET
        string "Default character set"
        default "iso-8859-1"
@@ -137,7 +147,7 @@ config THTTPD_MAXREALLOC
        ---help---
                Maximum string reallocation size.  Default: 4096
 
-config THTTPD_CGIINBUFFERSIZ
+config THTTPD_CGIINBUFFERSIZE
        int "CGI interpose input buffer size"
        default 512
        ---help---
@@ -236,7 +246,7 @@ choice
                the name of a subdirectory off of the user's actual home dir,
                something like "public_html".
 
-               3) Niether.  You can also leave both options undefined, and 
thttpd
+               3) Neither.  You can also leave both options undefined, and 
thttpd
                will not do anything special about tildes. Enabling both options
                is an error.
 
diff --git a/netutils/thttpd/libhttpd.c b/netutils/thttpd/libhttpd.c
index 9bb8d20d7..06212b4d0 100644
--- a/netutils/thttpd/libhttpd.c
+++ b/netutils/thttpd/libhttpd.c
@@ -2354,8 +2354,8 @@ int httpd_get_conn(httpd_server *hs, int listen_fd, 
httpd_conn *hc)
 
   ninfo("accept() new connection on listen_fd %d\n", listen_fd);
   sz = sizeof(sa);
-  hc->conn_fd = accept4(listen_fd, (struct sockaddr *)&sa, &sz,
-                        SOCK_CLOEXEC);
+  hc->conn_fd = accept4(listen_fd, (struct sockaddr *)&sa, &sz, 0);
+
   if (hc->conn_fd < 0)
     {
       if (errno == EWOULDBLOCK)

Reply via email to