1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/minimal-examples/http-client/minimal-http-client-multi/selftest.sh
Andy Green ac1229f2f7 minimal-http-client-multi: add POST
This adds support for POST in both h1 and h2 queues / stream binding.

The previous queueing tried to keep the "leader" wsi who made the
actual connection around and have it act on the transaction queue
tail if it had done its own thing.

This refactors it so instead, who is the "leader" moves down the
queue and the queued guys inherit the fd, SSL * and queue from the
old leader as they take over.

This lets them operate in their own wsi identity directly and gets
rid of all the "effective wsi" checks, which was applied incompletely
and getting out of hand considering the separate lws_mux checks for
h2 and other muxed protocols alongside it.

This change also allows one wsi at a time to own the transaction for
POST.  --post is added as an option to lws-minimal-http-client-multi
and 6 extra selftests with POST on h1/h2, pipelined or not and
staggered or not are added to the CI.
2020-02-21 17:32:41 +00:00

58 lines
2 KiB
Bash
Executable file

#!/bin/bash
#
# $1: path to minimal example binaries...
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
# that will be ./bin from your build dir
#
# $2: path for logs and results. The results will go
# in a subdir named after the directory this script
# is in
#
# $3: offset for test index count
#
# $4: total test count
#
# $5: path to ./minimal-examples dir in lws
#
# Test return code 0: OK, 254: timed out, other: error indication
. $5/selftests-library.sh
COUNT_TESTS=22
dotest $1 $2 warmcat
dotest $1 $2 warmcat-pipe -p
dotest $1 $2 warmcat-h1 --h1
dotest $1 $2 warmcat-h1-pipe --h1 -p
dotest $1 $2 warmcat-stag -s
dotest $1 $2 warmcat-pipe-stag -p -s
dotest $1 $2 warmcat-h1-stag --h1 -s
dotest $1 $2 warmcat-h1-pipe-stag --h1 -p -s
dotest $1 $2 warmcat-post --post
dotest $1 $2 warmcat-post-pipe --post -p
dotest $1 $2 warmcat-post-pipe-stag --post -p -s
dotest $1 $2 warmcat-h1-post --post --h1
dotest $1 $2 warmcat-h1-post-pipe --post --h1 -p
dotest $1 $2 warmcat-h1-post-pipe-stag --post --h1 -p -s
spawn "" $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
dotest $1 $2 localhost -l
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
dotest $1 $2 localhost-pipe -l -p
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
dotest $1 $2 localhost-h1 -l --h1
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
dotest $1 $2 localhost-h1-pipe -l --h1 -p
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
dotest $1 $2 localhost-stag -l -s
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
dotest $1 $2 localhost-pipe-stag -l -p -s
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
dotest $1 $2 localhost-h1-stag -l --h1 -s
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
dotest $1 $2 localhost-h1-pipe-stag -l --h1 -p -s
kill $SPID 2>/dev/null
wait $SPID 2>/dev/null
exit $FAILS