]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-bug-738785-switch-protocol
test-apt-cdrom: Fix for gnupg 2.1.15
[apt.git] / test / integration / test-bug-738785-switch-protocol
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6
7setupenvironment
8configarchitecture "i386"
9
10buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
11
12# setup http redirecting to https
13getlabelfromsuite() { echo 'Testcases'; }
14setupaptarchive --no-update
15changetohttpswebserver -o 'aptwebserver::support::http=false'
16webserverconfig 'aptwebserver::redirect::replace::/downgrademe/' "http://localhost:${APTHTTPPORT}/"
17webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "https://localhost:${APTHTTPSPORT}/"
18sed -i -e "s#:${APTHTTPSPORT}/#:${APTHTTPPORT}/redirectme#" -e 's# https:# http:#' rootdir/etc/apt/sources.list.d/*
19
20testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::Acquire::https=1 -o Debug::pkgAcquire::Worker=1
21
22msgtest 'Test that the webserver does not answer' 'http requests'
23downloadfile "http://localhost:${APTHTTPPORT}/pool/main/a/apt/apt_1.0/changelog" changelog >/dev/null 2>&1 && msgfail || msgpass
24
25echo "Acquire::Changelogs::URI::Label::Testcases \"http://localhost:${APTHTTPPORT}/redirectme/pool/@CHANGEPATH@/changelog\";" > rootdir/etc/apt/apt.conf.d/changelog.conf
26testsuccessequal "'http://localhost:${APTHTTPPORT}/redirectme/pool/main/a/apt/apt_1.0/changelog' apt.changelog" aptget changelog apt --print-uris
27
28cd downloaded
29testsuccess aptget changelog apt -d
30testsuccess test -s apt.changelog
31rm -f apt.changelog
32
33testsuccess aptget download apt
34testsuccess test -s apt_1.0_all.deb
35rm apt_1.0_all.deb
36cd - >/dev/null
37
38testsuccess aptget install apt -y
39testdpkginstalled 'apt'
40
41cd downloaded
42testfailureequal "E: The method 'https' is explicitly disabled via configuration.
43N: If you meant to use Tor remember to use tor+https instead of https." aptget download apt -o Dir::Bin::Methods::https=false
44testfailure test -e apt_1.0_all.deb
45cd - >/dev/null
46
47# check that downgrades from https to http are not allowed
48webserverconfig 'aptwebserver::support::http' 'true'
49sed -i -e "s#:${APTHTTPPORT}/redirectme#:${APTHTTPSPORT}/downgrademe#" -e 's# http:# https:#' rootdir/etc/apt/sources.list.d/*
50testfailure aptget update --allow-insecure-repositories -o Acquire::https::Timeout=1