]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Get rid of some HTTP/2 related types when NGHTTP2 is not available
authorArtem Boldariev <artem@boldariev.com>
Fri, 16 Jul 2021 11:57:08 +0000 (14:57 +0300)
committerArtem Boldariev <artem@boldariev.com>
Wed, 4 Aug 2021 07:32:27 +0000 (10:32 +0300)
This commit removes definitions of some DoH-related types when
libnghttp2 is not available.

lib/isc/netmgr/netmgr-int.h
lib/isc/netmgr/netmgr.c
lib/isc/tests/doh_test.c

index f588bc883bf58a454a6235370b149fe40ef1ad80..f46e7fce5a8752a8f59435e0ff92fae54f70dcb6 100644 (file)
@@ -314,15 +314,6 @@ typedef union {
        isc_nm_accept_cb_t accept;
 } isc__nm_cb_t;
 
-typedef struct isc_nm_httphandler isc_nm_httphandler_t;
-struct isc_nm_httphandler {
-       char *path;
-       isc_nm_recv_cb_t cb;
-       void *cbarg;
-       size_t extrahandlesize;
-       LINK(isc_nm_httphandler_t) link;
-};
-
 /*
  * Wrapper around uv_req_t with 'our' fields in it.  req->data should
  * always point to its parent.  Note that we always allocate more than
@@ -755,6 +746,7 @@ enum {
        STATID_ACTIVE = 10
 };
 
+#if HAVE_LIBNGHTTP2
 typedef struct isc_nmsocket_tls_send_req {
        isc_nmsocket_t *tlssock;
        isc_region_t data;
@@ -782,6 +774,14 @@ typedef struct isc_nm_httpcbarg {
        LINK(struct isc_nm_httpcbarg) link;
 } isc_nm_httpcbarg_t;
 
+typedef struct isc_nm_httphandler {
+       char *path;
+       isc_nm_recv_cb_t cb;
+       void *cbarg;
+       size_t extrahandlesize;
+       LINK(struct isc_nm_httphandler) link;
+} isc_nm_httphandler_t;
+
 struct isc_nm_http_endpoints {
        isc_mem_t *mctx;
 
@@ -836,6 +836,7 @@ typedef struct isc_nmsocket_h2 {
                void *cstream;
        } connect;
 } isc_nmsocket_h2_t;
+#endif /* HAVE_LIBNGHTTP2 */
 
 typedef void (*isc_nm_closehandlecb_t)(void *arg);
 /*%<
@@ -882,6 +883,7 @@ struct isc_nmsocket {
                isc__nm_uvreq_t *pending_req;
        } tls;
 
+#if HAVE_LIBNGHTTP2
        /*% TLS stuff */
        struct tlsstream {
                bool server;
@@ -902,6 +904,7 @@ struct isc_nmsocket {
        } tlsstream;
 
        isc_nmsocket_h2_t h2;
+#endif /* HAVE_LIBNGHTTP2 */
        /*%
         * quota is the TCP client, attached when a TCP connection
         * is established. pquota is a non-attached pointer to the
index ef17cfb23427149c878b08698de6702ec0e8d2c5..42a9d681c7b676f882863cf24eb47c08d934af20 100644 (file)
@@ -1515,7 +1515,9 @@ isc___nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr, isc_nmsocket_type type,
        isc_condition_init(&sock->scond);
        isc_refcount_init(&sock->references, 1);
 
+#if HAVE_LIBNGHTTP2
        memset(&sock->tlsstream, 0, sizeof(sock->tlsstream));
+#endif /* HAVE_LIBNGHTTP2 */
 
        NETMGR_TRACE_LOG("isc__nmsocket_init():%p->references = %" PRIuFAST32
                         "\n",
index 04ba18266209e3b824bdd1f48fb122edba4b99a6..198c7bfc230fdf6f3134e14c7251987713cdce2a 100644 (file)
@@ -9,7 +9,7 @@
  * information regarding copyright ownership.
  */
 
-#if HAVE_CMOCKA
+#if defined(HAVE_CMOCKA) && defined(HAVE_LIBNGHTTP2)
 #include <inttypes.h>
 #include <sched.h> /* IWYU pragma: keep */
 #include <setjmp.h>
@@ -2192,7 +2192,11 @@ main(void) {
 
 int
 main(void) {
+#if HAVE_LIBNGHTTP2
        printf("1..0 # Skipped: cmocka not available\n");
+#else
+       printf("1..0 # Skipped: libnghttp2 is not available\n");
+#endif
        return (SKIPPED_TEST_EXIT_CODE);
 }