-
Notifications
You must be signed in to change notification settings - Fork 10
/
test_server.sh
executable file
·52 lines (36 loc) · 1.72 KB
/
test_server.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -eux -o pipefail
function cleanup() {
set +e
kill $ZIG_SERVER_PID
echo "exit"
}
trap cleanup EXIT
cd $(dirname $0)
cd test
# Generate testing certificate
./gen_cert.sh
cd ../
# Checking memory leak
until nc -z localhost 8443; do sleep 1; done && curl https://localhost:8443 --insecure &
zig test src/main_test_server.zig --test-filter 'e2e server'
echo "Memory leak check passed"
zig run src/main_test_server.zig &
ZIG_SERVER_PID=$!
# wait for server becoming ready
until nc -z localhost 8443; do sleep 1; done
echo "READY"
curl https://localhost:8443 --tlsv1.3 --insecure | grep tls13-zig
# Testing Hello Retry Request
echo "GET / " | openssl s_client -groups x448:X25519 -servername localhost -connect localhost:8443 -ign_eof | grep tls13-zig
echo "GET / " | openssl s_client -groups x448:secp256r1 -servername localhost -connect localhost:8443 -ign_eof | grep tls13-zig
# Testing Resumption
echo "GET / " | openssl s_client -servername localhost -connect localhost:8443 -ign_eof -sess_out sess.pem | grep tls13-zig
echo "GET / " | openssl s_client -servername localhost -connect localhost:8443 -ign_eof -sess_in sess.pem | grep tls13-zig
# Testing Resumption with Hello Retry Request
echo "GET / " | openssl s_client -groups x448:X25519 -servername localhost -connect localhost:8443 -ign_eof -sess_out sess.pem | grep tls13-zig
echo "GET / " | openssl s_client -groups x448:X25519 -servername localhost -connect localhost:8443 -ign_eof -sess_in sess.pem | grep tls13-zig
# Testing 0-RTT Data
echo "GET / " > early_data.txt
RESULT=$(openssl s_client -servername localhost -connect localhost:8443 -ign_eof -sess_in sess.pem -early_data early_data.txt)
echo $RESULT | grep "Early data was accepted.*tls13-zig" > /dev/null