mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00

The vfork optimized spawn, stdxxx and terminal handling in the cgi implementation is quite mature and sophisticated, and useful for other things unrelated to cgi. Break it out into its own public api under LWS_WITH_SPAWN, off by default. Expand it so the parent wsi is optional, and the role and protocol bindings for stdxxx pipes can be set. Allow optional sul timeout and external lws_dll2 owner for extant children. Remove inline style from minimal http-server-cgi
36 lines
883 B
Bash
Executable file
36 lines
883 B
Bash
Executable file
#!/bin/sh
|
|
|
|
echo -e -n "content-type: text/html\x0d\x0a"
|
|
echo -e -n "transfer-encoding: chunked\x0d\x0a"
|
|
echo -e -n "\x0d\x0a"
|
|
|
|
echo "<html><meta charset="UTF-8"><body>"
|
|
echo "<h1>lwstest script stdout</h1>"
|
|
>&2 echo -n "lwstest script stderr: REQUEST_METHOD was $REQUEST_METHOD"
|
|
|
|
echo "<h2>REQUEST_METHOD=$REQUEST_METHOD</h2>"
|
|
|
|
if [ "$REQUEST_METHOD" = "POST" ] ; then
|
|
>&2 echo "lwstest script stderr: doing read"
|
|
echo "CONTENT_LENGTH=$CONTENT_LENGTH"
|
|
read -n $CONTENT_LENGTH line
|
|
>&2 echo "lwstest script stderr: done read"
|
|
|
|
echo "read=\"$line\""
|
|
else
|
|
echo "<table>"
|
|
echo "<tr><td colspan=\"2\">/proc/meminfo</td></tr>"
|
|
cat /proc/meminfo | while read line ; do
|
|
A=`echo "$line" | cut -d: -f1`
|
|
B=`echo "$line" | tr -s ' ' | cut -d' ' -f2-`
|
|
echo -e "<tr><td>$A</td>"
|
|
echo -e "<td>$B</td></tr>"
|
|
done
|
|
echo "</table>"
|
|
fi
|
|
|
|
echo "<br/>done"
|
|
echo "</body></html>"
|
|
|
|
exit 0
|
|
|