]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-https-no-redirect
test exitcode as well as string equality
[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 -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/'
15
16 msgtest 'download of a file works via' 'http'
17 downloadfile 'http://localhost:8080/working' httpfile >/dev/null 2>&1 && msgpass || msgfail
18 testfileequal httpfile 'alright'
19
20 msgtest 'download of a file works via' 'https'
21 downloadfile 'https://localhost:4433/working' httpsfile >/dev/null 2>&1 && msgpass || msgfail
22 testfileequal httpsfile 'alright'
23
24 msgtest 'download of a file does not work if' 'https redirected to http'
25 downloadfile 'https://localhost:4433/redirectme/working' redirectfile >curloutput 2>&1 && msgfail || msgpass
26
27 msgtest 'libcurl has forbidden access in last request to' 'http resource'
28 if grep -q -E -- 'Protocol "?http"? not supported or disabled in libcurl' curloutput; then
29 msgpass
30 else
31 cat curloutput
32 msgfail
33 fi
34
35