aboutsummaryrefslogtreecommitdiff
path: root/src/sp/transport/ws
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-11-09 20:10:32 -0800
committerGarrett D'Amore <garrett@damore.org>2024-11-09 20:22:50 -0800
commitcbe9a27ef7485977fbc7c713376b096b6723da3d (patch)
treebaba50d93018ac6ce6873be46284f5f893da6e39 /src/sp/transport/ws
parent0058b766b91f08b34dcef3c7bb55b216099f3f66 (diff)
downloadnng-cbe9a27ef7485977fbc7c713376b096b6723da3d.tar.gz
nng-cbe9a27ef7485977fbc7c713376b096b6723da3d.tar.bz2
nng-cbe9a27ef7485977fbc7c713376b096b6723da3d.zip
websocket: Do not allow a listener or dialer to change TLS while running
This also covers a few test cases that we were missing.
Diffstat (limited to 'src/sp/transport/ws')
-rw-r--r--src/sp/transport/ws/ws_test.c20
1 files changed, 20 insertions, 0 deletions
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 },
};