# doesn't use `cp`.
"$srcdir/../src/tlsproxy-add" "$1" < "$srcdir/$2" >/dev/null 2>&1
}
-tlsproxy() {
+tlsproxy_background() {
#valgrind --leak-check=full --error-exitcode=1 --track-fds=yes \
../src/tlsproxy -d2 "$@" >tlsproxy-log 2>&1 &
pid_tlsproxy=$!
}
-server() {
+server_background() {
gnutls-serv --http --port 4712 "$@" >/dev/null 2>&1 &
pid_server=$!
}
tlsproxy_setup
echo 'dXNlcm5hbWU6cGFzc3dvcmQ=' > digest-authentication
-tlsproxy -a digest-authentication 4711
-server --x509certfile "$srcdir/server.pem" \
- --x509keyfile "$srcdir/server-key.pem"
+tlsproxy_background -a digest-authentication 4711
+server_background --x509certfile "$srcdir/server.pem" \
+ --x509keyfile "$srcdir/server-key.pem"
wait_for_ports 4711 4712
rm -f digest-authentication
tlsproxy_setup
# Normal tests.
-tlsproxy 4711
-server --x509certfile "$srcdir/server.pem" \
- --x509keyfile "$srcdir/server-key.pem"
+tlsproxy_background 4711
+server_background --x509certfile "$srcdir/server.pem" \
+ --x509keyfile "$srcdir/server-key.pem"
wait_for_ports 4711 4712
# Stop server and try a "MITM" with a bad certificate.
echo
kill $pid_server || echo 'failed to kill gnutls-serv'
-server --x509certfile "$srcdir/server-bad.pem" \
- --x509keyfile "$srcdir/server-key.pem"
+server_background --x509certfile "$srcdir/server-bad.pem" \
+ --x509keyfile "$srcdir/server-key.pem"
wait_for_ports 4712
rm -f certificate-localhost-proxy.pem certificate-localhost-server.pem
tlsproxy_setup
# Normal tests.
-tlsproxy -u 4711
-server --x509certfile "$srcdir/server.pem" \
- --x509keyfile "$srcdir/server-key.pem"
+tlsproxy_background -u 4711
+server_background --x509certfile "$srcdir/server.pem" \
+ --x509keyfile "$srcdir/server-key.pem"
wait_for_ports 4711 4712
# Stop server and try a "MITM" with a bad certificate.
echo
kill $pid_server || echo 'failed to kill gnutls-serv'
-server --x509certfile "$srcdir/server-bad.pem" \
- --x509keyfile "$srcdir/server-key.pem"
+server_background --x509certfile "$srcdir/server-bad.pem" \
+ --x509keyfile "$srcdir/server-key.pem"
wait_for_ports 4712
rm -f certificate-localhost-proxy.pem certificate-localhost-server.pem