blob: ccae2227b88f3273352fcec7c04f9dc189a015ec (
plain)
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
|
#!/usr/bin/env sh
# Live HTTP proxy and CONNECT contract. The peer must be started with the
# transparent proxy enabled and both targets must be controlled test services.
set -eu
proxy=${YACY_SMOKE_PROXY:-}
http_target=${YACY_SMOKE_PROXY_HTTP_TARGET:-}
https_target=${YACY_SMOKE_PROXY_HTTPS_TARGET:-}
[ -n "$proxy" ] && [ -n "$http_target" ] && [ -n "$https_target" ] || {
echo "SKIP: set YACY_SMOKE_PROXY, YACY_SMOKE_PROXY_HTTP_TARGET and YACY_SMOKE_PROXY_HTTPS_TARGET" >&2
exit 2
}
timeout=${YACY_SMOKE_TIMEOUT:-30}
curl --silent --show-error --fail --max-time "$timeout" --proxy "$proxy" \
--noproxy '' \
"$http_target" >/dev/null
echo "ok 1 - HTTP proxy traffic"
# An HTTPS request through an HTTP proxy necessarily establishes a CONNECT tunnel.
curl --silent --show-error --fail --max-time "$timeout" --proxy "$proxy" \
--noproxy '' \
"$https_target" >/dev/null
echo "ok 2 - HTTPS CONNECT tunnel"
echo "PASS: proxy and CONNECT contract"
|