aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/websocket/websocket.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-11-05 22:49:59 -0800
committerGarrett D'Amore <garrett@damore.org>2024-11-05 22:49:59 -0800
commitf70c0b0bf0447fd5db784f8f6c41226d5c5f7846 (patch)
tree959c6b616b54d299c44ae91e4b43f6b5d6ed5179 /src/supplemental/websocket/websocket.c
parentc7eb7de23212dc4336b1568fc1488a877b34d453 (diff)
downloadnng-f70c0b0bf0447fd5db784f8f6c41226d5c5f7846.tar.gz
nng-f70c0b0bf0447fd5db784f8f6c41226d5c5f7846.tar.bz2
nng-f70c0b0bf0447fd5db784f8f6c41226d5c5f7846.zip
websocket: fix for setting user headers
This was a crasher bug (found by test suite).
Diffstat (limited to 'src/supplemental/websocket/websocket.c')
-rw-r--r--src/supplemental/websocket/websocket.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c
index b215c1da..8c622be6 100644
--- a/src/supplemental/websocket/websocket.c
+++ b/src/supplemental/websocket/websocket.c
@@ -2126,6 +2126,7 @@ nni_ws_listener_alloc(nng_stream_listener **wslp, const nng_url *url)
NNI_LIST_INIT(&l->pend, nni_ws, node);
NNI_LIST_INIT(&l->reply, nni_ws, node);
+ NNI_LIST_INIT(&l->headers, ws_header, node);
// make a private copy of the url structure.
if ((rv = nng_url_clone(&l->url, url)) != 0) {
@@ -2651,6 +2652,7 @@ nni_ws_dialer_alloc(nng_stream_dialer **dp, const nng_url *url)
}
NNI_LIST_INIT(&d->headers, ws_header, node);
NNI_LIST_INIT(&d->wspend, nni_ws, node);
+ NNI_LIST_INIT(&d->headers, ws_header, node);
nni_mtx_init(&d->mtx);
nni_cv_init(&d->cv, &d->mtx);