netutils/thttpd-fix-broken-CGI-and-fixup-Kconfig

This commit is contained in:
Tim Hardisty
2025-07-01 15:03:16 +01:00
committed by Xiang Xiao
parent c3e628c45a
commit 8c9e126f91
2 changed files with 15 additions and 5 deletions

View File

@@ -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.

View File

@@ -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)