rmyorston / busybox-w32

WIN32 native port of BusyBox.
https://frippery.org/busybox
Other
697 stars 126 forks source link

Sometimes, when httpd processes POST requests, the program is suspended #468

Closed q5n closed 1 month ago

q5n commented 1 month ago

busybox version is

$ busybox |head -2
BusyBox v1.37.0-FRP-5467-g9376eebd8 (2024-09-15 08:56:36 UTC)
(mingw64-gcc 14.1.1-3.fc40; mingw64-crt 11.0.1-3.fc40; glob)

my test script is:

#!/bin/sh
[ ! -d cgi-bin ] &&  mkdir cgi-bin
cat>cgi-bin/my.cgi <<'MY_CGI'
#!/bin/sh
echo "Content-type: text/plain;"
echo
if [ "$REQUEST_METHOD" = "POST" ]; then
    dd of=my.dat bs=1 count=${CONTENT_LENGTH}
    echo -n "success."
else
    echo -n "error!"
fi
MY_CGI
chmod 755 cgi-bin/my.cgi
httpd -p 127.0.0.1:8000
wget --post-data "$(seq -w 500)" -q -O - http://127.0.0.1:8000/cgi-bin/my.cgi

when I exec this script, it's suspended!

rmyorston commented 1 month ago

There was a problem with our implementation of poll(2). Fortunately, someone over at the Git for Windows project had spotted the same problem and has a workaround.

The issue with your CGI script should be fixed in the latest prereleases (PRE-5521 or above).

q5n commented 1 month ago

Thanks, it has been solved