post not work mini_httpd

From: Mori Hiroki <yamori813_at_yahoo.co.jp>
Date: Sat, 25 Feb 2023 22:29:20 UTC
Hi

I use mini_httpd on RT3050.

I try this cgi.

#!/bin/sh                                                                                                                 

echo "Content-Type: text/html"
echo ""
echo "OK"

if [ "${REQUEST_METHOD}" = "POST"  ]; then
echo `cat` > /tmp/xxx
fi

This cgi work on GET but not work on POST.
Firefox say connection reset.

I seem FreeBSD/amd64 is same.

This is patch.

--- mini_httpd.c.org    2018-10-27 04:47:50.000000000 +0900
+++ mini_httpd.c        2023-02-26 07:25:15.504936000 +0900
@@ -1842,7 +1842,8 @@
            /* Interposer process. */
            (void) close( p[0] );
            cgi_interpose_input( p[1] );
-           finish_request( 0 );
+//         finish_request( 0 );
+           exit ( 0 );
            }
        (void) close( p[1] );
        if ( p[0] != STDIN_FILENO )

Work fine both.

Regards..

Hiroki Mori