From 58602a28d2c92b603208f3e01c14c169d28cc7b0 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 2 Jul 2026 00:53:24 +0300 Subject: yhttpd: port ychat fixes, get it building + stable in Docker (task 9s0) Ports the ychat revival fixes (unsigned/size_t npos truncation, ofstream == NULL, tool::trim OOB, CGI popen -> execve, www.yChat.org links, g++ version gate, config.pl -I., NCURSES/CLI-disabled build) so yhttpd builds on modern GCC in a Rocky Linux 9 container, plus yhttpd-specific fixes found while verifying it under concurrent load: - listen() backlog was hardcoded to 1; bumped to SOMAXCONN. - sock::_close() closed sockets with unread request bytes still in the kernel receive buffer (read_http() only reads the GET line), so Linux sent an abortive RST instead of a FIN, racing the client's read of the response ("connection reset by peer" even though it was delivered). Fixed with a non-blocking, bounded drain before close() - confirmed via tcpdump: RSTs on every response before, zero after, across 140+ requests / concurrent bursts of 20. - Removed a duplicate _make_server_socket() call in start() (wrap.cpp's init_wrapper() already makes it before start() runs) that leaked a fd and would have double-initialized SSL if OPENSSL is ever enabled; caught by fresh-context review, documented honestly in DOCKER.md. - src/configure's dependency-checker predates 64-bit multilib distros (only checked /usr/lib, never /usr/lib64) and was missing an ncur move-aside entry for the NCURSES-disabled build. Added Dockerfile/.dockerignore/DOCKER.md documenting the build, the fixes, and the one known-but-unfixed landmine (a SIGILL heap corruption in sock::_close that reproduces on newer host GCC/glibc but not in the container - latent, not fixed). Co-Authored-By: Claude Sonnet 5 --- yhttpd/src/conf/conf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yhttpd/src/conf/conf.cpp') diff --git a/yhttpd/src/conf/conf.cpp b/yhttpd/src/conf/conf.cpp index 25884ca..f987755 100644 --- a/yhttpd/src/conf/conf.cpp +++ b/yhttpd/src/conf/conf.cpp @@ -174,7 +174,7 @@ conf::get_vector(string s_key) vector vec_ret; string s_val = get_elem(s_key); - for (unsigned i_pos = s_val.find(" "); i_pos != string::npos; i_pos = s_val.find(" ")) + for (size_t i_pos = s_val.find(" "); i_pos != string::npos; i_pos = s_val.find(" ")) { vec_ret.push_back(s_val.substr(0, i_pos)); s_val = s_val.substr(i_pos+1); -- cgit v1.2.3