From 614b219a27d973c40a3c3d7402ebe060096a38a5 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Thu, 20 Sep 2012 17:22:22 +0100 Subject: [PATCH] Marking WRITE end of a pipe as closed in handle_cgi_request() --- mongoose.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mongoose.c b/mongoose.c index 3d1ef32b..7990e621 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3133,9 +3133,11 @@ static void handle_cgi_request(struct mg_connection *conn, const char *prog) { !forward_body_data(conn, in, INVALID_SOCKET, NULL)) { goto done; } + // Close so child gets an EOF. fclose(in); in = NULL; + fd_stdin[1] = -1; // Now read CGI reply into a buffer. We need to set correct // status code, thus we need to see all HTTP headers first.