asynciodebian/masterdebian/stretch-backportsjessie-backportsmainproxy-ticketupstream
Last change
on this file since d84f0f7 was
d84f0f7,
checked in by Thomas Klute <thomas2.klute@…>, 7 years ago
|
Test 26_redirect_HTTP_to_HTTPS: Add --verbose option when using curl
With this option curl writes the headers it sends and receives to
stderr. This way they get included in the test log, making the HTTP
redirect visible.
|
-
Property mode set to
100755
|
File size:
1.5 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | # |
---|
3 | # This test checks if mod_rewrite rules can detect HTTPS connections |
---|
4 | # with "%{HTTPS}". |
---|
5 | |
---|
6 | set -e |
---|
7 | : ${srcdir:="."} |
---|
8 | . ${srcdir}/common.bash |
---|
9 | netns_reexec ${@} |
---|
10 | |
---|
11 | testdir="${srcdir}/tests/26_redirect_HTTP_to_HTTPS" |
---|
12 | TEST_NAME="$(basename ${testdir})" |
---|
13 | . $(dirname ${0})/proxy_backend.bash |
---|
14 | |
---|
15 | : ${TEST_HTTP_PORT:="9935"} |
---|
16 | export TEST_HTTP_PORT |
---|
17 | |
---|
18 | # "Proxy backend" functions are used to start the only instance needed |
---|
19 | # here without "runtests". We have to override BACKEND_PID and |
---|
20 | # BACKEND_PORT to make them match what a runtests-based test would |
---|
21 | # use. |
---|
22 | export BACKEND_PID="apache2.pid" |
---|
23 | export BACKEND_PORT="${TEST_PORT}" |
---|
24 | function stop_backend |
---|
25 | { |
---|
26 | backend_apache "${testdir}" "apache.conf" stop |
---|
27 | } |
---|
28 | backend_apache "${testdir}" "apache.conf" start "${TEST_LOCK}" |
---|
29 | trap stop_backend EXIT |
---|
30 | |
---|
31 | output="outputs/${TEST_NAME}.output" |
---|
32 | rm -f "$output" |
---|
33 | |
---|
34 | # Send status request over HTTP. This should get redirected to HTTPS. |
---|
35 | URL="http://${TEST_HOST}:${TEST_HTTP_PORT}/status?auto" |
---|
36 | if [ "$(basename ${HTTP_CLI})" = "curl" ]; then |
---|
37 | ${HTTP_CLI} --location --verbose --cacert authority/x509.pem "${URL}" \ |
---|
38 | >"${output}" |
---|
39 | elif [ "$(basename ${HTTP_CLI})" = "wget" ]; then |
---|
40 | ${HTTP_CLI} --ca-certificate=authority/x509.pem -O "${output}" "${URL}" |
---|
41 | else |
---|
42 | echo "No HTTP client (curl or wget) found, skipping." 2>&1 |
---|
43 | exit 77 |
---|
44 | fi |
---|
45 | |
---|
46 | # If the request was redirected correctly, the status report lists the |
---|
47 | # used ciphersuite. |
---|
48 | grep "Current TLS session: (TLS" "${output}" |
---|
49 | |
---|
50 | backend_apache "${testdir}" "apache.conf" stop |
---|
51 | trap - EXIT |
---|
Note: See
TracBrowser
for help on using the repository browser.