]>
Commit | Line | Data |
---|---|---|
dc95fee1 MV |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
dc95fee1 MV |
6 | |
7 | setupenvironment | |
8 | configarchitecture "i386" | |
9 | ||
0d58c26a | 10 | insertpackage 'stable' 'apt' 'all' '1' |
dc95fee1 MV |
11 | setupaptarchive --no-update |
12 | ||
0d58c26a | 13 | echo 'alright' > aptarchive/working |
4bba5a88 DK |
14 | changetohttpswebserver |
15 | webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/" | |
16 | webserverconfig 'aptwebserver::redirect::replace::/redirectme2/' "https://localhost:${APTHTTPSPORT}/" | |
c9c91069 | 17 | echo 'Dir::Bin::Methods::https+http "https";' > rootdir/etc/apt/apt.conf.d/99add-https-http-method |
dc95fee1 | 18 | |
0d58c26a | 19 | msgtest 'download of a file works via' 'http' |
6c0765c0 | 20 | testsuccess --nomsg downloadfile "http://localhost:${APTHTTPPORT}/working" httpfile |
0d58c26a | 21 | testfileequal httpfile 'alright' |
dc95fee1 | 22 | |
0d58c26a | 23 | msgtest 'download of a file works via' 'https' |
6c0765c0 | 24 | testsuccess --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/working" httpsfile |
0d58c26a | 25 | testfileequal httpsfile 'alright' |
c9c91069 DK |
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 | |
dc95fee1 | 36 | |
0d58c26a | 37 | msgtest 'download of a file does not work if' 'https redirected to http' |
6c0765c0 | 38 | testfailure --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/redirectme/working" redirectfile |
0d58c26a DK |
39 | |
40 | msgtest 'libcurl has forbidden access in last request to' 'http resource' | |
4bba5a88 | 41 | testsuccess --nomsg grep -q -E -- "Redirection from https to 'http://.*' is forbidden" rootdir/tmp/testfailure.output |
c9c91069 DK |
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' |