]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-https-no-redirect
The entire concept of PendingError() is flawed :/.
[apt.git] / test / integration / test-apt-https-no-redirect
CommitLineData
dc95fee1
MV
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
dc95fee1
MV
6
7setupenvironment
8configarchitecture "i386"
9
0d58c26a 10insertpackage 'stable' 'apt' 'all' '1'
dc95fee1
MV
11setupaptarchive --no-update
12
0d58c26a 13echo 'alright' > aptarchive/working
4bba5a88
DK
14changetohttpswebserver
15webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/"
16webserverconfig 'aptwebserver::redirect::replace::/redirectme2/' "https://localhost:${APTHTTPSPORT}/"
c9c91069 17echo 'Dir::Bin::Methods::https+http "https";' > rootdir/etc/apt/apt.conf.d/99add-https-http-method
dc95fee1 18
0d58c26a 19msgtest 'download of a file works via' 'http'
6c0765c0 20testsuccess --nomsg downloadfile "http://localhost:${APTHTTPPORT}/working" httpfile
0d58c26a 21testfileequal httpfile 'alright'
dc95fee1 22
0d58c26a 23msgtest 'download of a file works via' 'https'
6c0765c0 24testsuccess --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/working" httpsfile
0d58c26a 25testfileequal httpsfile 'alright'
c9c91069
DK
26rm -f httpfile httpsfile
27
28msgtest 'download of http file works via' 'https+http'
29testsuccess --nomsg downloadfile "http://localhost:${APTHTTPPORT}/working" httpfile
30testfileequal httpfile 'alright'
31
32msgtest 'download of https file works via' 'https+http'
33testsuccess --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/working" httpsfile
34testfileequal httpsfile 'alright'
35rm -f httpfile httpsfile
dc95fee1 36
0d58c26a 37msgtest 'download of a file does not work if' 'https redirected to http'
6c0765c0 38testfailure --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/redirectme/working" redirectfile
0d58c26a
DK
39
40msgtest 'libcurl has forbidden access in last request to' 'http resource'
4bba5a88 41testsuccess --nomsg grep -q -E -- "Redirection from https to 'http://.*' is forbidden" rootdir/tmp/testfailure.output
c9c91069
DK
42
43msgtest 'download of a file does work if' 'https+http redirected to https'
44testsuccess --nomsg downloadfile "https+http://localhost:${APTHTTPPORT}/redirectme2/working" redirectfile
45testfileequal redirectfile 'alright'