source: mod_gnutls/test/test-26_redirect_HTTP_to_HTTPS.bash @ 3c123cd

debian/masterdebian/stretch-backportsupstream
Last change on this file since 3c123cd was 1872744, checked in by Thomas Klute <thomas2.klute@…>, 2 years ago

Test suite: Rename bash function backend_apache to apache_service

  • Property mode set to 100755
File size: 1.4 KB
Line 
1#!/bin/bash
2#
3# This test checks if mod_rewrite rules can detect HTTPS connections
4# with "%{HTTPS}".
5
6set -e
7: ${srcdir:="."}
8. ${srcdir}/common.bash
9netns_reexec ${@}
10
11testdir="${srcdir}/tests/26_redirect_HTTP_to_HTTPS"
12TEST_NAME="$(basename ${testdir})"
13. $(dirname ${0})/apache_service.bash
14
15: ${TEST_HTTP_PORT:="9935"}
16export 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_PORT to make it
20# match what a runtests-based test would use.
21export BACKEND_PORT="${TEST_PORT}"
22function stop_backend
23{
24    apache_service "${testdir}" "apache.conf" stop
25}
26apache_service "${testdir}" "apache.conf" start "${TEST_LOCK}"
27trap stop_backend EXIT
28
29output="outputs/${TEST_NAME}.output"
30rm -f "$output"
31
32# Send status request over HTTP. This should get redirected to HTTPS.
33URL="http://${TEST_HOST}:${TEST_HTTP_PORT}/status?auto"
34if [ "$(basename ${HTTP_CLI})" = "curl" ]; then
35    ${HTTP_CLI} --location --verbose --cacert authority/x509.pem "${URL}" \
36                >"${output}"
37elif [ "$(basename ${HTTP_CLI})" = "wget" ]; then
38    ${HTTP_CLI} --ca-certificate=authority/x509.pem -O "${output}" "${URL}"
39else
40    echo "No HTTP client (curl or wget) found, skipping." 2>&1
41    exit 77
42fi
43
44# If the request was redirected correctly, the status report lists the
45# used ciphersuite.
46grep "Current TLS session: (TLS" "${output}"
47
48apache_service "${testdir}" "apache.conf" stop
49trap - EXIT
Note: See TracBrowser for help on using the repository browser.