#!/bin/sh
set -e
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64'
}
TESTFILE='aptarchive/testfile'
-cp -a ${TESTDIR}/framework $TESTFILE
-cp -a ${TESTDIR}/framework "${TESTFILE}2"
+cp -a "${TESTDIR}/framework" "$TESTFILE"
+cp -a "${TESTDIR}/framework" "${TESTFILE}2"
followuprequest() {
local DOWN='./downloaded/testfile'
webserverconfig 'aptwebserver::support::content-range' 'false'
copysource $TESTFILE 1M $DOWN
- testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' "SHA1:$(sha1sum "$TESTFILE" | cut -d' ' -f 1)"
+ testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' "SHA256:$(sha256sum "$TESTFILE" | cut -d' ' -f 1)"
testwebserverlaststatuscode '416' "$DOWNLOADLOG"
webserverconfig 'aptwebserver::support::content-range' 'true'
testrun() {
webserverconfig 'aptwebserver::support::range' 'true'
+ webserverconfig 'aptwebserver::response-header::Accept-Ranges' 'bytes'
local DOWN='./downloaded/testfile'
copysource $TESTFILE 0 $DOWN
testdownloadfile 'old data' "${1}/testfile" "$DOWN" '='
testwebserverlaststatuscode '200' "$DOWNLOADLOG"
- webserverconfig 'aptwebserver::support::range' 'false'
+ if [ "${1%%:*}" = 'https' ] && expr match "$1" "^.*/redirectme$" >/dev/null; then
+ webserverconfig 'aptwebserver::response-header::Accept-Ranges' 'none'
+ else
+ webserverconfig 'aptwebserver::support::range' 'false'
+ fi
copysource $TESTFILE 20 $DOWN
testdownloadfile 'no server support' "${1}/testfile" "$DOWN" '='
testrun "$1"
}
-serverconfigs 'http://localhost:8080'
+serverconfigs "http://localhost:${APTHTTPPORT}"
changetohttpswebserver
-serverconfigs 'https://localhost:4433'
+serverconfigs "https://localhost:${APTHTTPSPORT}"
+
+webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "https://localhost:${APTHTTPSPORT}/"
+serverconfigs "https://localhost:${APTHTTPSPORT}/redirectme"
+serverconfigs "http://localhost:${APTHTTPPORT}/redirectme"