From 0058b766b91f08b34dcef3c7bb55b216099f3f66 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 9 Nov 2024 15:24:43 -0800 Subject: TLS configuration changed to use discret _set_tls and _get_tls functions. This is simpler, and more reliable than using socket options. --- src/supplemental/http/http_client.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'src/supplemental/http/http_client.c') diff --git a/src/supplemental/http/http_client.c b/src/supplemental/http/http_client.c index b156794c..0fbe3ef9 100644 --- a/src/supplemental/http/http_client.c +++ b/src/supplemental/http/http_client.c @@ -1,5 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // Copyright 2019 Devolutions // @@ -25,7 +25,7 @@ struct nng_http_client { nni_list aios; nni_mtx mtx; bool closed; - nni_aio * aio; + nni_aio *aio; nng_stream_dialer *dialer; }; @@ -42,10 +42,10 @@ static void http_dial_cb(void *arg) { nni_http_client *c = arg; - nni_aio * aio; + nni_aio *aio; int rv; - nng_stream * stream; - nni_http_conn * conn; + nng_stream *stream; + nni_http_conn *conn; nni_mtx_lock(&c->mtx); rv = nni_aio_result(c->aio); @@ -101,7 +101,7 @@ nni_http_client_init(nni_http_client **cp, const nni_url *url) int rv; nni_http_client *c; nng_url my_url; - const char * scheme; + const char *scheme; if ((scheme = nni_http_stream_scheme(url->u_scheme)) == NULL) { return (NNG_EADDRINVAL); @@ -138,14 +138,13 @@ nni_http_client_init(nni_http_client **cp, const nni_url *url) int nni_http_client_set_tls(nni_http_client *c, nng_tls_config *tls) { - return (nng_stream_dialer_set_ptr(c->dialer, NNG_OPT_TLS_CONFIG, tls)); + return (nng_stream_dialer_set_tls(c->dialer, tls)); } int nni_http_client_get_tls(nni_http_client *c, nng_tls_config **tlsp) { - return (nng_stream_dialer_get_ptr( - c->dialer, NNG_OPT_TLS_CONFIG, (void **) tlsp)); + return (nng_stream_dialer_get_tls(c->dialer, tlsp)); } int @@ -207,12 +206,12 @@ typedef enum http_txn_state { } http_txn_state; typedef struct http_txn { - nni_aio * aio; // lower level aio + nni_aio *aio; // lower level aio nni_list aios; // upper level aio(s) -- maximum one nni_http_client *client; - nni_http_conn * conn; - nni_http_req * req; - nni_http_res * res; + nni_http_conn *conn; + nni_http_req *req; + nni_http_res *res; nni_http_chunks *chunks; http_txn_state state; } http_txn; @@ -246,13 +245,13 @@ http_txn_finish_aios(http_txn *txn, int rv) static void http_txn_cb(void *arg) { - http_txn * txn = arg; - const char * str; - char * end; + http_txn *txn = arg; + const char *str; + char *end; int rv; uint64_t len; nni_iov iov; - char * dst; + char *dst; size_t sz; nni_http_chunk *chunk = NULL; -- cgit v1.2.3-70-g09d2