From bf9796140ea5885da66a51c4f85d837c786eddf0 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Mon, 8 Feb 2021 12:43:21 -0800 Subject: [PATCH] fixup! start refactoring isc_nm_httprequest() into read/send --- lib/isc/include/isc/tls.h | 2 +- lib/isc/netmgr/http.c | 12 ++++-------- lib/isc/netmgr/tlsstream.c | 9 ++++++--- lib/isc/tls.c | 1 - 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/isc/include/isc/tls.h b/lib/isc/include/isc/tls.h index 216c8b4f80..49f1cf71ca 100644 --- a/lib/isc/include/isc/tls.h +++ b/lib/isc/include/isc/tls.h @@ -17,7 +17,7 @@ #include typedef struct ssl_ctx_st isc_tlsctx_t; -typedef struct ssl_st isc_tls_t; +typedef struct ssl_st isc_tls_t; void isc_tls_initialize(void); diff --git a/lib/isc/netmgr/http.c b/lib/isc/netmgr/http.c index 5f7222f576..89af897f00 100644 --- a/lib/isc/netmgr/http.c +++ b/lib/isc/netmgr/http.c @@ -1061,13 +1061,8 @@ server_on_begin_headers_callback(nghttp2_session *ngsession, isc__nmsocket_init(socket, session->serversocket->mgr, isc_nm_httpsocket, (isc_nmiface_t *)&iface); socket->h2 = (isc_nmsocket_h2_t){ - .bufpos = 0, - .bufsize = 0, .buf = isc_mem_allocate(session->mctx, MAX_DNS_MESSAGE_SIZE), .psock = socket, - .handler = NULL, - .request_path = NULL, - .query_data = NULL, .stream_id = frame->hd.stream_id, .session = session }; @@ -2210,9 +2205,10 @@ void isc__nm_http_initsocket(isc_nmsocket_t *sock) { REQUIRE(sock != NULL); - memset(&sock->h2, 0, sizeof(sock->h2)); - sock->h2.request_type = ISC_HTTP_REQ_UNSUPPORTED; - sock->h2.request_scheme = ISC_HTTP_SCHEME_UNSUPPORTED; + sock->h2 = (isc_nmsocket_h2_t){ + .request_type = ISC_HTTP_REQ_UNSUPPORTED, + .request_scheme = ISC_HTTP_SCHEME_UNSUPPORTED, + }; if (sock->type == isc_nm_httplistener) { ISC_LIST_INIT(sock->h2.handlers); diff --git a/lib/isc/netmgr/tlsstream.c b/lib/isc/netmgr/tlsstream.c index 61883a8d5f..37d6ce8140 100644 --- a/lib/isc/netmgr/tlsstream.c +++ b/lib/isc/netmgr/tlsstream.c @@ -245,7 +245,7 @@ tls_do_bio(isc_nmsocket_t *sock) { /* Data from TLS to network */ pending = BIO_pending(sock->tlsstream.app_bio); if (pending > 0) { - /*TODO Should we keep the track of these requests in a list? */ + /* TODO Should we keep track of these requests in a list? */ isc_nmsocket_tls_send_req_t *send_req = NULL; if (pending > TLS_BUF_SIZE) { pending = TLS_BUF_SIZE; @@ -891,8 +891,11 @@ isc__nm_async_tlsconnect(isc__networker_t *worker, isc__netievent_t *ev0) { tlssock->timer_initialized = true; tlssock->tlsstream.state = TLS_INIT; - /* We ignore the error code because even in the case of failure callback - * gets called and the error code gets passed to it. */ + /* + * We ignore the return code, because even in the case of + * failure, the callback will be called and the error code + * passed to it. + */ (void)isc_nm_tcpconnect(worker->mgr, (isc_nmiface_t *)&ievent->local, (isc_nmiface_t *)&ievent->peer, tls_connect_cb, tlssock, tlssock->connect_timeout, 0); diff --git a/lib/isc/tls.c b/lib/isc/tls.c index 2c41f37ec5..8a6388d0d9 100644 --- a/lib/isc/tls.c +++ b/lib/isc/tls.c @@ -337,7 +337,6 @@ isc_tlsctx_enable_http2client_alpn(isc_tlsctx_t *ctx) { SSL_CTX_set_alpn_protos(ctx, (const unsigned char *)NGHTTP2_PROTO_ALPN, NGHTTP2_PROTO_ALPN_LEN); #endif /* OPENSSL_VERSION_NUMBER >= 0x10002000L */ - } #ifndef OPENSSL_NO_NEXTPROTONEG