aboutsummaryrefslogtreecommitdiff
path: root/tests/testutil.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2019-12-28 10:55:13 -0800
committerGarrett D'Amore <garrett@damore.org>2019-12-28 12:41:31 -0800
commit255a85d10f68a898c671f9387da61e0ba62a61c7 (patch)
tree17b93ed72f14b023677234a5cb870efe4f9f4f35 /tests/testutil.c
parent50b5f060548987de6f5ac65f39fa0eecb597decb (diff)
downloadnng-255a85d10f68a898c671f9387da61e0ba62a61c7.tar.gz
nng-255a85d10f68a898c671f9387da61e0ba62a61c7.tar.bz2
nng-255a85d10f68a898c671f9387da61e0ba62a61c7.zip
fixes #986 ws_read_finish_str free invalid pointer
Also, this has refactored the websocket stream test to the new acutest.h, and includes a much deeper test of fragmentation and reassembly of websocket streams.
Diffstat (limited to 'tests/testutil.c')
-rw-r--r--tests/testutil.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/testutil.c b/tests/testutil.c
index ef748b99..1c65c996 100644
--- a/tests/testutil.c
+++ b/tests/testutil.c
@@ -123,6 +123,18 @@ testutil_htons(uint16_t in)
return (in);
}
+uint32_t
+testutil_htonl(uint32_t in)
+{
+#ifdef NNG_LITTLE_ENDIAN
+ in = ((in >> 24u) & 0xffu) |
+ ((in >> 8u) & 0xff00u) |
+ ((in << 8u) & 0xff0000u) |
+ ((in << 24u) & 0xff000000u);
+#endif
+ return (in);
+}
+
// testutil_next_port returns a "next" allocation port.
// Ports are chosen by starting from a random point within a
// range (normally 38000-40000, but other good places to choose