From 0ed4ae0ae33457b84d215fed03198b864aa17be9 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Thu, 28 Mar 2024 02:17:13 +0100 Subject: [PATCH] curl: add support for Web Sockets (experimental, disabled per default) --- subprojects/packagefiles/curl/meson.build | 20 +++++++++++++++++++ .../packagefiles/curl/meson_options.txt | 1 + .../packagefiles/curl/tests/meson.build | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/subprojects/packagefiles/curl/meson.build b/subprojects/packagefiles/curl/meson.build index e49d743719..eb18cb45ff 100644 --- a/subprojects/packagefiles/curl/meson.build +++ b/subprojects/packagefiles/curl/meson.build @@ -1013,6 +1013,24 @@ idn_opt = idn_opt.require( # }}} +# Web sockets. {{{ + +ws_opt = get_option( + 'websockets', +).require( + http_opt.allowed(), + error_message: HTTP_DISABLED_ERROR, +).require( + cdata.get('SIZEOF_CURL_OFF_T') > 4, + error_message: 'curl_off_t is too small to enable WebSockets support', +) + +cdata.set('USE_WEBSOCKETS', ws_opt.allowed()) + +wss_opt = ws_opt.allowed() and ssl_opt.allowed() ? ws_opt : DISABLED_OPT + +# }}} + # ZLIB. {{{ libz_opt = get_option('libz') @@ -1669,6 +1687,8 @@ foreach _section, _optlist : { ['SMTPS'], ['TELNET'], ['TFTP'], + ['WS'], + ['WSS'], ], 'ssl_backends': [ ['OpenSSL'], diff --git a/subprojects/packagefiles/curl/meson_options.txt b/subprojects/packagefiles/curl/meson_options.txt index a26476a34f..6067bba296 100644 --- a/subprojects/packagefiles/curl/meson_options.txt +++ b/subprojects/packagefiles/curl/meson_options.txt @@ -38,6 +38,7 @@ option('socketpair' , type: 'feature', value: 'enabled') option('sspi' , type: 'feature') option('unixsockets' , type: 'feature') option('verbose-strings', type: 'feature', value: 'enabled') +option('websockets' , type: 'feature', value: 'disabled') option('zstd' , type: 'feature') # Asynchronous DNS. diff --git a/subprojects/packagefiles/curl/tests/meson.build b/subprojects/packagefiles/curl/tests/meson.build index 949f9ff25e..4376d461f0 100644 --- a/subprojects/packagefiles/curl/tests/meson.build +++ b/subprojects/packagefiles/curl/tests/meson.build @@ -79,6 +79,12 @@ if not get_option('curldebug') '!1908', '!1972', '!2100', + '!2300', + '!2301', + '!2302', + '!2303', + '!2304', + '!2307', ] endif if ipv6_opt.disabled()