build: disable TCP_NODELAY for emscripten

In WebAssembly, using `TCP_NODELAY` fails with:
```
* Could not set TCP_NODELAY: Protocol not available
```

Add a new feature macro in `curl_setup.h` telling whether `TCP_NODELAY`
is known to be supported at runtime, when defined at compile-time.

Keep `TCP_NODELAY` guards at their current positions to ensure the
necessary headers (e.g. `netinet/tcp.h` and `netinet/in.h`) define it.

Reported-by: Jeroen Ooms
Fixes #17974
Closes #18155
This commit is contained in:
Viktor Szakats 2025-08-03 23:48:53 +02:00
parent 74ba04f5b2
commit 06c12cc08b
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
4 changed files with 11 additions and 6 deletions

View file

@ -1125,6 +1125,11 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
#define USE_HTTP3
#endif
/* WebAssembly builds have TCP_NODELAY, but runtime support is missing. */
#ifndef __EMSCRIPTEN__
#define CURL_TCP_NODELAY_SUPPORTED
#endif
/* Certain Windows implementations are not aligned with what curl expects,
so always use the local one on this platform. E.g. the mingw-w64
implementation can return wrong results for non-ASCII inputs. */