From b3576e7205d630c9e25df62b971db890f3b7c40c Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 11 May 2020 15:08:52 +0100 Subject: [PATCH] ss: make sure to use LWS_WRITE_HTTP_FINAL with SS EOM flag When most of ss-h2 was combined into ss-h1 during development, the h2 difference about needing HTTP_FINAL to signal h2 FIN flag was accidentally dropped. In many cases the peer can infer it, from, eg, content-length reached. But we need to replace explicitly doing it to cover all cases. --- lib/secure-streams/protocols/ss-h1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/secure-streams/protocols/ss-h1.c b/lib/secure-streams/protocols/ss-h1.c index 4376f41c1..ad06088fe 100644 --- a/lib/secure-streams/protocols/ss-h1.c +++ b/lib/secure-streams/protocols/ss-h1.c @@ -514,7 +514,8 @@ malformed: lws_ptr_diff(p, buf + LWS_PRE), f); if (lws_write(wsi, buf + LWS_PRE, lws_ptr_diff(p, buf + LWS_PRE), - LWS_WRITE_HTTP) != (int)lws_ptr_diff(p, buf + LWS_PRE)) { + (f & LWSSS_FLAG_EOM) ? LWS_WRITE_HTTP_FINAL : LWS_WRITE_HTTP) != + (int)lws_ptr_diff(p, buf + LWS_PRE)) { lwsl_err("%s: write failed\n", __func__); return -1; }