From e718055f825581375e800920b4d7df60479ff3f2 Mon Sep 17 00:00:00 2001 From: rlgrpe Date: Fri, 9 Oct 2026 08:38:24 +0300 Subject: [PATCH] curl-sys: define HAVE_POLL so curl 8.x uses poll() instead of select() curl >= 8.x gates lib/select.c on HAVE_POLL; HAVE_POLL_FINE is the pre-8.x name. Without HAVE_POLL libcurl falls back to select(), and VERIFY_SOCK rejects any fd >= FD_SETSIZE (1024): the connect succeeds, SO_ERROR is 0, and cf_socket_connect still returns CURLE_COULDNT_CONNECT and closes the socket. Observed in production with ~130+ concurrent proxied clients. --- curl-sys/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/curl-sys/build.rs b/curl-sys/build.rs index 433a6c519..5119ed47f 100644 --- a/curl-sys/build.rs +++ b/curl-sys/build.rs @@ -415,6 +415,12 @@ fn main() { // poll() on various versions of macOS are janky, so only use it // on non-macOS unix-likes. This matches the official default // build configuration as well. + // + // curl 8.x gates select.c on HAVE_POLL (HAVE_POLL_FINE is the + // pre-8.x name). Without it libcurl silently falls back to + // select(), and any socket with fd >= FD_SETSIZE (1024) fails + // with CURLE_COULDNT_CONNECT right after the TCP handshake. + .define("HAVE_POLL", None) .define("HAVE_POLL_FINE", None); }