- downloadfile "$1/_config/set/aptwebserver::support::range/true" '/dev/null' >/dev/null
- testwebserverlaststatuscode '200'
-
- copysource $TESTFILE 0 ./testfile
- testdownloadfile 'no data' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
-
- copysource $TESTFILE 20 ./testfile
- testdownloadfile 'valid partial data' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '206'
-
- copysource /dev/zero 20 ./testfile
- testdownloadfile 'invalid partial data' "${1}/testfile" './testfile' '!='
- testwebserverlaststatuscode '206'
-
- copysource $TESTFILE 1M ./testfile
- testdownloadfile 'completely downloaded file' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '416'
-
- copysource /dev/zero 1M ./testfile
- testdownloadfile 'too-big partial file' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
-
- copysource /dev/zero 20 ./testfile
- touch ./testfile
- testdownloadfile 'old data' "${1}/testfile" './testfile' '='
- testwebserverlaststatuscode '200'
+ webserverconfig 'aptwebserver::support::range' 'true'
+ webserverconfig 'aptwebserver::response-header::Accept-Ranges' 'bytes'
+ local DOWN='./downloaded/testfile'
+
+ copysource $TESTFILE 0 $DOWN
+ testdownloadfile 'no data' "${1}/testfile" "$DOWN" '='
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
+
+ copysource $TESTFILE 20 $DOWN
+ testdownloadfile 'valid partial data' "${1}/testfile" "$DOWN" '='
+ testwebserverlaststatuscode '206' "$DOWNLOADLOG"
+
+ copysource /dev/zero 20 $DOWN
+ testdownloadfile 'invalid partial data' "${1}/testfile" "$DOWN" '!='
+ testwebserverlaststatuscode '206' "$DOWNLOADLOG"
+
+ webserverconfig 'aptwebserver::closeOnError' 'false'
+ followuprequest "$1"
+ webserverconfig 'aptwebserver::closeOnError' 'true'
+ followuprequest "$1"
+ webserverconfig 'aptwebserver::closeOnError' 'false'
+
+ copysource /dev/zero 1M $DOWN
+ testdownloadfile 'too-big partial file' "${1}/testfile" "$DOWN" '='
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
+
+ copysource /dev/zero 20 $DOWN
+ touch $DOWN
+ testdownloadfile 'old data' "${1}/testfile" "$DOWN" '='
+ testwebserverlaststatuscode '200' "$DOWNLOADLOG"
+
+ if [ "${1%%:*}" = 'https' ] && expr match "$1" "^.*/redirectme$" >/dev/null; then
+ webserverconfig 'aptwebserver::response-header::Accept-Ranges' 'none'
+ else
+ webserverconfig 'aptwebserver::support::range' 'false'
+ fi