From 303f84fbbfc4ee04b9f62e12bb2c1106834a2371 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 3 Jan 2018 10:26:11 -0800 Subject: Fix websocket hang after sending one message. This fixes a problem where the websocket would only send one message, then no others, due to not clearing the "frame" busy flag on completion of the frame transmit. We have also added a test that tries to send 10 messages back and forth to make sure that we catch this kind of problem in the future. Finally we've fixed some problems that were found when testing edge cases around the protocol, which were responsible for invalid memory accesses. --- src/supplemental/http/server.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/supplemental/http/server.c') diff --git a/src/supplemental/http/server.c b/src/supplemental/http/server.c index 64ed9e11..cce73765 100644 --- a/src/supplemental/http/server.c +++ b/src/supplemental/http/server.c @@ -1,6 +1,6 @@ // -// Copyright 2017 Staysail Systems, Inc. -// Copyright 2017 Capitar IT Group BV +// Copyright 2018 Staysail Systems, Inc. +// Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -298,6 +298,11 @@ http_sconn_error(http_sconn *sc, uint16_t err) return; } + if (sc->close) { + if (nni_http_res_set_header(res, "Connection", "close") != 0) { + http_sconn_close(sc); + } + } sc->res = res; nni_http_write_res(sc->http, res, sc->txaio); } -- cgit v1.2.3-70-g09d2