]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: merge `ENABLE_QUIC` C macro into `USE_HTTP3`
authorViktor Szakats <commit@vsz.me>
Thu, 11 Apr 2024 16:35:08 +0000 (16:35 +0000)
committerViktor Szakats <commit@vsz.me>
Sat, 13 Apr 2024 08:33:27 +0000 (08:33 +0000)
Before this patch `lib/curl_setup.h` defined these two macros right
next to each other, then the source code used them interchangeably.

After this patch, `USE_HTTP3` guards all HTTP/3 / QUIC features.
(Like `USE_HTTP2` does for HTTP/2.) `ENABLE_QUIC` is no longer used.

This patch doesn't change the way HTTP/3 is enabled via autotools
or CMake. Builders who enabled HTTP/3 manually by defining both of
these macros via `CPPFLAGS` can now delete `-DENABLE_QUIC`.

Closes #13352

15 files changed:
lib/altsvc.c
lib/config-os400.h
lib/connect.c
lib/curl_setup.h
lib/curl_trc.c
lib/http.c
lib/http.h
lib/setopt.c
lib/url.c
lib/version.c
lib/vquic/vquic-tls.c
lib/vquic/vquic-tls.h
lib/vquic/vquic.c
lib/vquic/vquic.h
lib/vquic/vquic_int.h

index 22e7ad1d838e94c158a499e0897b562689b07751..b72a59612a0bd9b67a9fbae83f7069dbb4e70411 100644 (file)
@@ -303,7 +303,7 @@ struct altsvcinfo *Curl_altsvc_init(void)
 #ifdef USE_HTTP2
     | CURLALTSVC_H2
 #endif
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
     | CURLALTSVC_H3
 #endif
     ;
index be531f39e1dac4cba693798d02393c73ded2b2a1..018e90af7e26f54ba141f9dd08e57e96f1729255 100644 (file)
 
 /* Define to enable HTTP3 support (experimental, requires NGTCP2, QUICHE or
    MSH3) */
-#undef ENABLE_QUIC
+#undef USE_HTTP3
 
 /* Version number of package */
 #undef VERSION
index 4a130f061631e8a080394682cd5003cc6b223a09..bf85e640f89f7316a385b2ecc3dc6d80f7c7973b 100644 (file)
@@ -1117,7 +1117,7 @@ const
 #endif
 struct transport_provider transport_providers[] = {
   { TRNSPRT_TCP, Curl_cf_tcp_create },
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
   { TRNSPRT_QUIC, Curl_cf_quic_create },
 #endif
 #ifndef CURL_DISABLE_TFTP
index c2d656be173501f5d21dee12e29e762e4cd9b828..620680b54ff4f6a32a8ea17d9ad97dea0ae35139 100644 (file)
@@ -860,7 +860,6 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
 #error "Multi-SSL combined with QUIC is not supported"
 #endif
 
-#define ENABLE_QUIC
 #define USE_HTTP3
 #endif
 
index 691aefc3777825d3beb248eb385a511fa50f2f19..54bdd80000fa2c72aacd34b3ab19b69e186db158 100644 (file)
@@ -230,7 +230,7 @@ static struct Curl_cftype *cf_types[] = {
   &Curl_cft_haproxy,
   &Curl_cft_socks_proxy,
 #endif /* !CURL_DISABLE_PROXY */
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
   &Curl_cft_http3,
 #endif
 #if !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER)
index dea166c3dddd409f84384999849d795463519c24..dbec52158f7d9a14b05c38b4478ede0a0be412a7 100644 (file)
@@ -3199,7 +3199,7 @@ CURLcode Curl_http_statusline(struct Curl_easy *data,
 #ifdef USE_HTTP2
   case 20:
 #endif
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
   case 30:
 #endif
     /* TODO: we should verify that responses do not switch major
index 47fae63c782b214c17fd8389d455887563bc24d9..31a5962cfc05661ea932d6212cbc5ce9f6f0984a 100644 (file)
@@ -44,7 +44,7 @@ typedef enum {
 
 #ifndef CURL_DISABLE_HTTP
 
-#if defined(ENABLE_QUIC)
+#if defined(USE_HTTP3)
 #include <stdint.h>
 #endif
 
index 0d06ecec357f198d33c3aec86e802d258cffaf04..1ca10401ab51afd7e01cc06b010ac5e5f55b84ac 100644 (file)
@@ -915,7 +915,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
       /* accepted */
       break;
 #endif
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
     case CURL_HTTP_VERSION_3:
     case CURL_HTTP_VERSION_3ONLY:
       /* accepted */
index 5c04153744ed4af75c31040ad69b7b3ca9b18c3e..8e2a5b12892f5f3268a9d9dffb3c73f72dff767c 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -3085,7 +3085,7 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
 #ifdef USE_HTTP2
                                    | ALPN_h2
 #endif
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
                                    | ALPN_h3
 #endif
       ) & data->asi->flags;
index 7ab67f83b0d817de977c500af523ea1fbacaa8cb..f0fc5ea7bac6eb359013dc4ae86ed88a6b47dc56 100644 (file)
@@ -152,7 +152,7 @@ char *curl_version(void)
 #ifdef USE_NGHTTP2
   char h2_version[40];
 #endif
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
   char h3_version[40];
 #endif
 #ifdef USE_LIBRTMP
@@ -233,7 +233,7 @@ char *curl_version(void)
   Curl_http2_ver(h2_version, sizeof(h2_version));
   src[i++] = h2_version;
 #endif
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
   Curl_quic_ver(h3_version, sizeof(h3_version));
   src[i++] = h3_version;
 #endif
@@ -468,7 +468,7 @@ static const struct feat features_table[] = {
 #if defined(USE_NGHTTP2)
   FEATURE("HTTP2",       NULL,                CURL_VERSION_HTTP2),
 #endif
-#if defined(ENABLE_QUIC)
+#if defined(USE_HTTP3)
   FEATURE("HTTP3",       NULL,                CURL_VERSION_HTTP3),
 #endif
 #if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \
@@ -643,7 +643,7 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
   }
 #endif
 
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
   {
     static char quicbuffer[80];
     Curl_quic_ver(quicbuffer, sizeof(quicbuffer));
index 6b968200b369241977d0021515c2936ee4d728fb..1ad8cb7f0a11ffddabc1e069bd70b66fe279a274 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "curl_setup.h"
 
-#if defined(ENABLE_QUIC) && \
+#if defined(USE_HTTP3) && \
   (defined(USE_OPENSSL) || defined(USE_GNUTLS) || defined(USE_WOLFSSL))
 
 #ifdef USE_OPENSSL
@@ -333,4 +333,4 @@ CURLcode Curl_vquic_tls_verify_peer(struct curl_tls_ctx *ctx,
 }
 
 
-#endif /* !ENABLE_QUIC && (USE_OPENSSL || USE_GNUTLS || USE_WOLFSSL) */
+#endif /* !USE_HTTP3 && (USE_OPENSSL || USE_GNUTLS || USE_WOLFSSL) */
index be18fccc5e075b7a804aead4771bfbc74509a93f..1d35fd0e62b89cf62b5f4d9d5f3b1609d110209b 100644 (file)
@@ -28,7 +28,7 @@
 #include "bufq.h"
 #include "vtls/openssl.h"
 
-#if defined(ENABLE_QUIC) && \
+#if defined(USE_HTTP3) && \
   (defined(USE_OPENSSL) || defined(USE_GNUTLS) || defined(USE_WOLFSSL))
 
 struct curl_tls_ctx {
@@ -94,6 +94,6 @@ CURLcode Curl_vquic_tls_verify_peer(struct curl_tls_ctx *ctx,
                                     struct Curl_easy *data,
                                     struct ssl_peer *peer);
 
-#endif /* !ENABLE_QUIC && (USE_OPENSSL || USE_GNUTLS || USE_WOLFSSL) */
+#endif /* !USE_HTTP3 && (USE_OPENSSL || USE_GNUTLS || USE_WOLFSSL) */
 
 #endif /* HEADER_CURL_VQUIC_TLS_H */
index 066caf98667294e2587449f76290601e6e1fd99c..9ce1e4626d6d6c763a10b9b65de5264808dcda87 100644 (file)
@@ -59,7 +59,7 @@
 #include "memdebug.h"
 
 
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
 
 #ifdef O_BINARY
 #define QLOGMODE O_WRONLY|O_CREAT|O_BINARY
@@ -663,7 +663,7 @@ CURLcode Curl_conn_may_http3(struct Curl_easy *data,
   return CURLE_OK;
 }
 
-#else /* ENABLE_QUIC */
+#else /* USE_HTTP3 */
 
 CURLcode Curl_conn_may_http3(struct Curl_easy *data,
                              const struct connectdata *conn)
@@ -674,4 +674,4 @@ CURLcode Curl_conn_may_http3(struct Curl_easy *data,
   return CURLE_NOT_BUILT_IN;
 }
 
-#endif /* !ENABLE_QUIC */
+#endif /* !USE_HTTP3 */
index dc73957aaf64b17c00f14ddb3d4e98c627ef1ece..c1ca1df6aa0c1a6376c8404d2798a9a9321728cc 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "curl_setup.h"
 
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
 struct Curl_cfilter;
 struct Curl_easy;
 struct connectdata;
@@ -52,11 +52,11 @@ bool Curl_conn_is_http3(const struct Curl_easy *data,
 
 extern struct Curl_cftype Curl_cft_http3;
 
-#else /* ENABLE_QUIC */
+#else /* USE_HTTP3 */
 
 #define Curl_conn_is_http3(a,b,c)   FALSE
 
-#endif /* !ENABLE_QUIC */
+#endif /* !USE_HTTP3 */
 
 CURLcode Curl_conn_may_http3(struct Curl_easy *data,
                              const struct connectdata *conn);
index c218a949c7274df8dfc51a3c2c73177386109e33..754e1f5910fbd3c6920b6e2d1133493367e283ee 100644 (file)
@@ -27,7 +27,7 @@
 #include "curl_setup.h"
 #include "bufq.h"
 
-#ifdef ENABLE_QUIC
+#ifdef USE_HTTP3
 
 #define MAX_PKT_BURST 10
 #define MAX_UDP_PAYLOAD_SIZE  1452
@@ -88,6 +88,6 @@ CURLcode vquic_recv_packets(struct Curl_cfilter *cf,
                             size_t max_pkts,
                             vquic_recv_pkt_cb *recv_cb, void *userp);
 
-#endif /* !ENABLE_QUIC */
+#endif /* !USE_HTTP3 */
 
 #endif /* HEADER_CURL_VQUIC_QUIC_INT_H */