aboutsummaryrefslogtreecommitdiff
path: root/tests/ws.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-12-22 19:18:05 -0800
committerGarrett D'Amore <garrett@damore.org>2018-12-22 19:20:12 -0800
commitd00483eadbee48b820a8a79163c5296953b6f5cb (patch)
tree2124acb66086e03ae2d1c913910cb96496d91bcc /tests/ws.c
parentf94a25d6fa2f75a7e4d64ac1f998c4c0f459c00a (diff)
downloadnng-d00483eadbee48b820a8a79163c5296953b6f5cb.tar.gz
nng-d00483eadbee48b820a8a79163c5296953b6f5cb.tar.bz2
nng-d00483eadbee48b820a8a79163c5296953b6f5cb.zip
Add some wild card validation tests for URLs.
These tests are intended to demonstrate that we are not affected by the bug described in #821.
Diffstat (limited to 'tests/ws.c')
-rw-r--r--tests/ws.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ws.c b/tests/ws.c
index 0add1a07..e126cb39 100644
--- a/tests/ws.c
+++ b/tests/ws.c
@@ -103,6 +103,25 @@ TestMain("WebSocket Transport", {
So(nng_dial(s2, addr, NULL, 0) == 0);
});
+ Convey("Wild card hostname works", {
+ nng_socket s1;
+ nng_socket s2;
+ char addr[NNG_MAXADDRLEN];
+
+ So(nng_pair_open(&s1) == 0);
+ So(nng_pair_open(&s2) == 0);
+ Reset({
+ nng_close(s2);
+ nng_close(s1);
+ });
+ trantest_next_address(addr, "ws://*:%u/test");
+ So(nng_listen(s1, addr, NULL, 0) == 0);
+ nng_msleep(100);
+ // reset port back one
+ trantest_prev_address(addr, "ws://127.0.0.1:%u/test");
+ So(nng_dial(s2, addr, NULL, 0) == 0);
+ });
+
Convey("Incorrect URL paths do not work", {
nng_socket s1;
nng_socket s2;