From 3016385671a167e09d91a5fbff9cd9bdeb0996cf Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 7 May 2021 10:01:59 +0100 Subject: [PATCH] h2: migration: migrate for_ss The attribute indicating that a wsi belongs to an SS object also must be migrated when we split out the original transaction wsi into a new nwsi, if we're not going to lose track of its affiliation. Likewise if the affiliated SS object points to the original wsi, we have to migrate his pointer when we migrate the wsi. Taking care of this book-keeping is necessary to get correct behaviours at close-time. --- lib/roles/h2/http2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/roles/h2/http2.c b/lib/roles/h2/http2.c index be28537d9..d71214d0e 100644 --- a/lib/roles/h2/http2.c +++ b/lib/roles/h2/http2.c @@ -1510,6 +1510,18 @@ lws_h2_parse_end_of_frame(struct lws *wsi) #endif #endif /* CLIENT */ +#if defined(LWS_WITH_SECURE_STREAMS) + if (wsi->for_ss) { + lws_ss_handle_t *h = (lws_ss_handle_t *)lws_get_opaque_user_data(wsi); + + h2n->swsi->for_ss = 1; + wsi->for_ss = 0; + + if (h->wsi == wsi) + h->wsi = h2n->swsi; + } +#endif + h2n->swsi->a.protocol = wsi->a.protocol; if (h2n->swsi->user_space && !h2n->swsi->user_space_externally_allocated)