4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
"i386"
10 buildsimplenativepackage
'apt' 'all' '1.0' 'stable'
12 # setup http redirecting to https
13 getlabelfromsuite
() { echo 'Testcases'; }
14 setupaptarchive
--no-update
15 changetowebserver
-o 'aptwebserver::redirect::replace::/redirectme/=https://localhost:4433/' \
16 -o 'aptwebserver::redirect::replace::/downgrademe/=http://localhost:8080/' \
17 -o 'aptwebserver::support::http=false'
18 changetohttpswebserver
19 sed -i -e 's#:4433/#:8080/redirectme#' -e 's# https:# http:#' rootdir
/etc
/apt
/sources.list.d
/*
21 testsuccess aptget update
-o Debug
::Acquire
::http
=1 -o Debug
::Acquire
::https
=1 -o Debug
::pkgAcquire
::Worker
=1
23 msgtest
'Test that the webserver does not answer' 'http requests'
24 downloadfile
'http://localhost:8080/pool/main/a/apt/apt_1.0/changelog' changelog
>/dev
/null
2>&1 && msgfail
|| msgpass
26 echo 'Acquire::Changelogs::URI::Label::Testcases "http://localhost:8080/redirectme/pool/CHANGEPATH/changelog";' > rootdir
/etc
/apt
/apt.conf.d
/changelog.conf
27 testsuccessequal
"'http://localhost:8080/redirectme/pool/main/a/apt/apt_1.0/changelog' apt.changelog" aptget changelog apt
--print-uris
30 testsuccess aptget changelog apt
-d
31 testsuccess
test -s apt.changelog
34 testsuccess aptget download apt
35 testsuccess
test -s apt_1.0_all.deb
39 testsuccess aptget
install apt
-y
40 testdpkginstalled
'apt'
42 # install a slowed down file: otherwise its to fast to reproduce combining
43 NEWMETHODS
="$(readlink -f rootdir)/usr/lib/apt/methods"
44 OLDMETHODS
="$(readlink -f rootdir/usr/lib/apt/methods)"
48 IFS
="$(printf "\n\b")"
49 for METH
in $(find "$OLDMETHODS" ! -type d); do
50 ln -s "$OLDMETHODS/$(basename "$METH")" "$NEWMETHODS"
53 rm "$NEWMETHODS/https"
56 testfailureequal
"E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found.
57 N: Is the package apt-transport-https installed?" aptget download apt
-q=0
58 testfailure
test -e apt_1.0_all.deb
61 # revert to all methods
62 ln -s "$OLDMETHODS/https" "$NEWMETHODS"
64 # check that downgrades from https to http are not allowed
65 webserverconfig
'aptwebserver::support::http' 'true'
66 sed -i -e 's#:8080/redirectme#:4433/downgrademe#' -e 's# http:# https:#' rootdir
/etc
/apt
/sources.list.d
/*
67 testfailure aptget update
--allow-insecure-repositories