From: Artem Boldariev Date: Fri, 16 Jul 2021 11:57:08 +0000 (+0300) Subject: Get rid of some HTTP/2 related types when NGHTTP2 is not available X-Git-Tag: v9.17.17~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=170cc41d5c7a25aa0451e74f5ee3fbee29f6885b;p=thirdparty%2Fbind9.git Get rid of some HTTP/2 related types when NGHTTP2 is not available This commit removes definitions of some DoH-related types when libnghttp2 is not available. --- diff --git a/lib/isc/netmgr/netmgr-int.h b/lib/isc/netmgr/netmgr-int.h index f588bc883bf..f46e7fce5a8 100644 --- a/lib/isc/netmgr/netmgr-int.h +++ b/lib/isc/netmgr/netmgr-int.h @@ -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 diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index ef17cfb2342..42a9d681c7b 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -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", diff --git a/lib/isc/tests/doh_test.c b/lib/isc/tests/doh_test.c index 04ba1826620..198c7bfc230 100644 --- a/lib/isc/tests/doh_test.c +++ b/lib/isc/tests/doh_test.c @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -#if HAVE_CMOCKA +#if defined(HAVE_CMOCKA) && defined(HAVE_LIBNGHTTP2) #include #include /* IWYU pragma: keep */ #include @@ -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); }