From cbe9a27ef7485977fbc7c713376b096b6723da3d Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 9 Nov 2024 20:10:32 -0800 Subject: websocket: Do not allow a listener or dialer to change TLS while running This also covers a few test cases that we were missing. --- src/sp/transport/ws/ws_test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/sp') diff --git a/src/sp/transport/ws/ws_test.c b/src/sp/transport/ws/ws_test.c index 9115338f..0f514cfe 100644 --- a/src/sp/transport/ws/ws_test.c +++ b/src/sp/transport/ws/ws_test.c @@ -170,11 +170,31 @@ test_ws_recv_max(void) NUTS_CLOSE(s1); } +void +test_ws_no_tls(void) +{ + nng_socket s0; + nng_listener l; + nng_dialer d; + char *addr; + nng_tls_config *tls; + + NUTS_ADDR(addr, "ws"); + NUTS_OPEN(s0); + NUTS_PASS(nng_listener_create(&l, s0, addr)); + NUTS_FAIL(nng_listener_get_tls(l, &tls), NNG_ENOTSUP); + + NUTS_PASS(nng_dialer_create(&d, s0, addr)); + NUTS_FAIL(nng_dialer_get_tls(d, &tls), NNG_ENOTSUP); + NUTS_CLOSE(s0); +} + TEST_LIST = { { "ws url path filters", test_ws_url_path_filters }, { "ws wild card port", test_wild_card_port }, { "ws wild card host", test_wild_card_host }, { "ws empty host", test_empty_host }, { "ws recv max", test_ws_recv_max }, + { "ws no tls", test_ws_no_tls }, { NULL, NULL }, }; -- cgit v1.2.3-70-g09d2