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