source: mod_gnutls/test/test-26_redirect_HTTP_to_HTTPS.bash @ f0923c4

debian/masterdebian/stretch-backportsjessie-backportsupstream mod_gnutls/0.7.3
Last change on this file since f0923c4 was 67f2f58, checked in by Thomas Klute <thomas2.klute@…>, 4 years ago

Support curl or Wget for test case "26_redirect_HTTP_to_HTTPS"

  • 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
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})/proxy_backend.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_PID and
20# BACKEND_PORT to make them match what a runtests-based test would
21# use.
22export BACKEND_PID="apache2.pid"
23export BACKEND_PORT="${TEST_PORT}"
24function stop_backend
25{
26    backend_apache "${testdir}" "apache.conf" stop
27}
28backend_apache "${testdir}" "apache.conf" start "${TEST_LOCK}"
29trap stop_backend EXIT
30
31output="outputs/${TEST_NAME}.output"
32rm -f "$output"
33
34# Send status request over HTTP. This should get redirected to HTTPS.
35URL="http://${TEST_HOST}:${TEST_HTTP_PORT}/status?auto"
36if [ "$(basename ${HTTP_CLI})" = "curl" ]; then
37    ${HTTP_CLI} --location --cacert authority/x509.pem "${URL}" >"${output}"
38elif [ "$(basename ${HTTP_CLI})" = "wget" ]; then
39    ${HTTP_CLI} --ca-certificate=authority/x509.pem -O "${output}" "${URL}"
40else
41    echo "No HTTP client (curl or wget) found, skipping." 2>&1
42    exit 77
43fi
44
45# If the request was redirected correctly, the status report lists the
46# used ciphersuite.
47grep "Current TLS session: (TLS" "${output}"
48
49backend_apache "${testdir}" "apache.conf" stop
50trap - EXIT
Note: See TracBrowser for help on using the repository browser.