static void tcpnodelay(struct Curl_easy *data, curl_socket_t sockfd)
{
-#ifdef TCP_NODELAY
+#if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED)
curl_socklen_t onoff = (curl_socklen_t) 1;
int level = IPPROTO_TCP;
char buffer[STRERROR_LEN];
#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. */
logmsg("====> Client connect");
-#ifdef TCP_NODELAY
+#if defined(TCP_NODELAY) && !defined(__EMSCRIPTEN__)
/*
* Disable the Nagle algorithm to make it easier to send out a large
* response in many small segments to torture the clients more.
/* work around for handling trailing headers */
static int already_recv_zeroed_chunk = FALSE;
-#ifdef TCP_NODELAY
+#if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED)
/* returns true if the current socket is an IP one */
static bool socket_domain_is_ip(void)
{
return CURL_SOCKET_BAD;
}
-#ifdef TCP_NODELAY
+#if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED)
if(socket_domain_is_ip()) {
/* Disable the Nagle algorithm */
curl_socklen_t flag = 1;
}
memset(req2, 0, sizeof(*req2));
logmsg("====> Client connect DATA");
-#ifdef TCP_NODELAY
+#if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED)
if(socket_domain_is_ip()) {
/* Disable the Nagle algorithm */
curl_socklen_t flag = 1;
all_sockets[num_sockets] = msgsock;
num_sockets += 1;
-#ifdef TCP_NODELAY
+#if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED)
if(socket_domain_is_ip()) {
/*
* Disable the Nagle algorithm to make it easier to send out a large