Subject: windows: support to bind to a specific IPv6 address
[platform/upstream/libwebsockets.git] / test-server / lws-cgi-test.sh
1 #!/bin/sh
2
3 echo -e -n "Content-type: text/html\x0d\x0a"
4 echo -e -n "\x0d\x0a"
5
6 echo "<html><body>"
7 echo "<h1>lwstest script stdout</h1>"
8 >&2 echo "lwstest script stderr: $REQUEST_METHOD"
9
10 echo "<h2>REQUEST_METHOD=$REQUEST_METHOD</h2>"
11
12 if [ "$REQUEST_METHOD" = "POST" ] ; then
13         >&2 echo "lwstest script stderr: doing read"
14         echo "CONTENT_LENGTH=$CONTENT_LENGTH"
15         read -n $CONTENT_LENGTH line
16         >&2 echo "lwstest script stderr: done read"
17
18         echo "read=\"$line\""
19 else
20         echo "<table>"
21         echo "<tr><td colspan=\"2\" style=\"font-size:120%;text-align:center\">/proc/meminfo</td></tr>"
22         cat /proc/meminfo | while read line ; do
23                 A=`echo "$line" | cut -d: -f1`
24                 B=`echo "$line" | tr -s ' ' | cut -d' ' -f2-`
25                 echo -e "<tr><td style=\"background-color:#f0e8c0\">$A</td>"
26                 echo -e "<td style=\"text-align:right\">$B</td></tr>"
27         done
28         echo "</table>"
29 fi
30
31 echo "<br/>done"
32 echo "</body></html>"
33
34 exit 0
35