From 79bb26b6bda46dd04a0b90f0fe20bfb4cdbaef9f Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 8 Jul 2019 11:33:52 +0100 Subject: [PATCH] HPACK: take sizing to 0 as clear existing Apparently some peers set the HPACK size to zero and then try to set HPACK dynamic elements. Take it to mean keep the same size but clear it down. --- lib/roles/h2/hpack.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/roles/h2/hpack.c b/lib/roles/h2/hpack.c index 9c218e543..f8b89c344 100644 --- a/lib/roles/h2/hpack.c +++ b/lib/roles/h2/hpack.c @@ -597,6 +597,11 @@ lws_hpack_dynamic_size(struct lws *wsi, int size) (int)dyn->num_entries, size, nwsi->vhost->h2.set.s[H2SET_HEADER_TABLE_SIZE]); + if (!size) { + size = dyn->num_entries * 8; + lws_hpack_destroy_dynamic_header(wsi); + } + if (size > (int)nwsi->vhost->h2.set.s[H2SET_HEADER_TABLE_SIZE]) { lwsl_info("rejecting hpack dyn size %u vs %u\n", size, nwsi->vhost->h2.set.s[H2SET_HEADER_TABLE_SIZE]);