libwebsockets/test-apps/lws-cgi-test.sh
Andy Green 904a9c0920 http2: make usable
HTTP/2 support is now able to serve the test server, complete with
websockets, from a single vhost.

 - This works the same with both OpenSSL and mbedTLS.

 - POST is now wired up and works (also for file upload).

 - CGI is wired up and works.

 - Redirect is adapted and works

 - lwsws works.

 - URI urldecode, sanitation and argument parsing wired up for :path

valgrind clean (aside from openssl-style false uninit data usage in mbedtls send occasionally)

h2spec reports:

$ h2spec  -h 127.0.0.1 -p 7681 -t -k -o 1
...
145 tests, 145 passed, 0 skipped, 0 failed"

Incorporates:

 - "https://github.com/warmcat/libwebsockets/pull/1039
	Fixes issue with -Werror=unused-variable flag

 - 2c843a1395
	ssl: fix infinite loop on client cert verification failure

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>"

Caused and fixes Coverity 184887 - 184892
2017-10-16 17:13:49 +08:00

37 lines
944 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><body>"
echo "<h1>lwstest script stdout</h1>"
>&2 echo "lwstest script stderr: $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\" style=\"font-size:120%;text-align:center\">/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 style=\"background-color:#f0e8c0\">$A</td>"
echo -e "<td style=\"text-align:right\">$B</td></tr>"
done
echo "</table>"
fi
echo "<br/>done"
echo "</body></html>"
exit 0