From 56d26accd325265e4f9350ea080096f5fc9e01c6 Mon Sep 17 00:00:00 2001 From: Girts Date: Sat, 6 Jun 2020 06:51:15 -0700 Subject: [PATCH] protocol: fix readonly handling (#373) Previously, if running in readonly mode (`-R`), we would keep accumulating incoming websocket data to `pss->buffer`, resizing it with every incoming message. This would also break the `RESIZE` operation as we would never get rid of the `INPUT` message. Now we discard `INPUT` messages in `readonly` mode, 1) allowing resize to work and 2) preventing the buffer from growing indefinitely. --- src/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol.c b/src/protocol.c index 9586075..fbefa54 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -358,7 +358,7 @@ int callback_tty(struct lws *wsi, enum lws_callback_reasons reason, void *user, switch (command) { case INPUT: if (proc->pty == 0) break; - if (server->readonly) return 0; + if (server->readonly) break; char *data = xmalloc(pss->len - 1); memcpy(data, pss->buffer + 1, pss->len - 1); -- 2.43.4