From 4b3af7fb67fc2554a27299390aa375df4f30c1a7 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 5 Feb 2026 12:42:59 +0100 Subject: [PATCH] lib: disable websockets early if no http To prevent inconsistent `CURL_DISABLE_WEBSOCKETS` states between source files. Follow-up to 8edc0338f30f458f812f9ea355de1240771fa343 #20351 Closes #20526 --- lib/curl_setup.h | 3 +++ lib/ws.c | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 5c1e97aea6..4e49145f84 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -289,6 +289,9 @@ # define CURL_DISABLE_HEADERS_API 1 # define CURL_DISABLE_HSTS 1 # define CURL_DISABLE_HTTP_AUTH 1 +# ifndef CURL_DISABLE_WEBSOCKETS +# define CURL_DISABLE_WEBSOCKETS /* no WebSockets without HTTP present */ +# endif #endif /* ================================================================ */ diff --git a/lib/ws.c b/lib/ws.c index 3a4671b6fa..6ed417185e 100644 --- a/lib/ws.c +++ b/lib/ws.c @@ -24,12 +24,6 @@ #include "curl_setup.h" #include "urldata.h" -#ifdef CURL_DISABLE_HTTP -/* no WebSockets without HTTP present */ -#undef CURL_DISABLE_WEBSOCKETS -#define CURL_DISABLE_WEBSOCKETS 1 -#endif - #ifndef CURL_DISABLE_WEBSOCKETS #include "url.h"