You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2025/07/03 02:42:17 UTC
(nuttx-apps) branch master updated (c3e628c45 -> e6a335ded)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
from c3e628c45 nshlib/md5: Support reading from standard input
new 8c9e126f9 netutils/thttpd-fix-broken-CGI-and-fixup-Kconfig
new e6a335ded Fix Compiler warnings
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
netutils/thttpd/Kconfig | 16 +++++++++++++---
netutils/thttpd/libhttpd.c | 28 +++++++++++++++++++---------
2 files changed, 32 insertions(+), 12 deletions(-)
(nuttx-apps) 01/02: netutils/thttpd-fix-broken-CGI-and-fixup-Kconfig
Posted by xi...@apache.org.
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 <56...@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)
(nuttx-apps) 02/02: Fix Compiler warnings
Posted by xi...@apache.org.
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 e6a335ded005a75829bd50baa328f89c247c5764
Author: Tim Hardisty <56...@users.noreply.github.com>
AuthorDate: Tue Jul 1 15:26:52 2025 +0100
Fix Compiler warnings
---
netutils/thttpd/libhttpd.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/netutils/thttpd/libhttpd.c b/netutils/thttpd/libhttpd.c
index 06212b4d0..2d6a558e6 100644
--- a/netutils/thttpd/libhttpd.c
+++ b/netutils/thttpd/libhttpd.c
@@ -1589,9 +1589,7 @@ static void ls_child(int argc, char **argv)
FAR httpd_conn *hc = (FAR httpd_conn *)strtoul(argv[1], NULL, 16);
DIR *dirp;
struct dirent *de;
- int namlen;
static int maxnames = 0;
- int oldmax;
int nnames;
static char *names;
static char **nameptrs;
@@ -1615,6 +1613,18 @@ static void ls_child(int argc, char **argv)
char *timestr;
int i;
+ /* Compiler was warning that dirp was not initialised and it wasn't.
+ * But whether this is correct or not I am not sure.
+ */
+
+ dirp = opendir(hc->expnfilename);
+ if (dirp == NULL)
+ {
+ nerr("ERROR: opendir %s: %d\n", hc->expnfilename, errno);
+ httpd_send_err(hc, 404, err404title, "", err404form, hc->encodedurl);
+ return;
+ }
+
httpd_unlisten(hc->hs);
send_mime(hc, 200, ok200title, "", "", "text/html; charset=%s",
(off_t) - 1, hc->sb.st_mtime);
@@ -1639,11 +1649,11 @@ static void ls_child(int argc, char **argv)
fputs(html_html, fp);
fputs(html_hdtitle, fp);
- fprintf(fp, "Index of %s", hc->encodedurl, hc->encodedurl);
+ fprintf(fp, "Index of %s", hc->encodedurl);
fputs(html_titlehd, fp);
fputs(html_body, fp);
fputs(html_hdr2, fp);
- fprintf(fp, "Index of %s", hc->encodedurl, hc->encodedurl);
+ fprintf(fp, "Index of %s", hc->encodedurl);
fputs(html_endhdr2, fp);
fputs(html_crlf, fp);
fputs("<PRE>\r\nmode links bytes last-changed name\r\n<HR>", fp);
@@ -1663,7 +1673,6 @@ static void ls_child(int argc, char **argv)
}
else
{
- oldmax = maxnames;
maxnames *= 2;
names = RENEW(names, char, oldmax * PATH_MAX,
maxnames * PATH_MAX);
@@ -1833,7 +1842,7 @@ static void ls_child(int argc, char **argv)
/* And print. */
fprintf(fp,
- "%s %3ld %10lld %s <A HREF=\"/%.500s%s\">%s</A>%s%s%s\n",
+ "%s %3d %10d %s <A HREF=\"/%.500s%s\">%s</A>%s%s%s\n",
modestr, 0, (int16_t)sb.st_size, timestr, encrname,
S_ISDIR(sb.st_mode) ? "/" : "", nameptrs[i], linkprefix,
link, fileclass);
@@ -1890,7 +1899,8 @@ static int ls(httpd_conn *hc)
argv[0] = arg;
child = task_create("CGI child", CONFIG_THTTPD_CGI_PRIORITY,
- CONFIG_THTTPD_CGI_STACKSIZE, ls_child, argv);
+ CONFIG_THTTPD_CGI_STACKSIZE, (main_t)ls_child,
+ argv);
if (child < 0)
{
nerr("ERROR: task_create: %d\n", errno);