From 018750b77d9a4884b500c333c856a2454bf0b77d Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Tue, 1 Dec 2020 20:04:19 +0100 Subject: [PATCH] Closing stdin --- src/client.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client.cpp b/src/client.cpp index 1033d8b..0afb664 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -424,6 +424,10 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col : ((req.getMethod() == "POST" || req.getMethod() == "PUT") ? -1 : 0); socket->receive(pipes.stdin, len); + if (req.getMethod() != "GET") { + // Close only if no Websocket upgrade is possible + fclose(pipes.stdin); + } t = new thread(php_error_handler, prefix, pipes.stderr); string line; @@ -457,7 +461,6 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col req.respond(statuscode); goto respond; } else { - fclose(pipes.stdin); int c = fgetc(pipes.stdout); if (c == -1) { // No Data -> Error