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