]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-778375-server-has-no-reason-phrase
test: Use a file to determine TEST_DEFAULT_GROUP
[apt.git] / test / integration / test-bug-778375-server-has-no-reason-phrase
CommitLineData
905fba60
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
905fba60
DK
6
7setupenvironment
8configarchitecture 'native'
9
10echo 'found' > aptarchive/working
11changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=/' \
12 -o 'aptwebserver::httpcode::200=200' -o 'aptwebserver::httpcode::404=404' \
13 -o 'aptwebserver::httpcode::301=301'
148c0491 14webserverconfig 'aptwebserver::empty-response-header::' 'foobar'
905fba60
DK
15
16testdownload() {
17 rm -f downfile
18 msgtest "download of a $1 via" "${3%%:*}"
19 $2 --nomsg downloadfile "$3" downfile
20
21 cp rootdir/tmp/testsuccess.output download.log
22 #looking for "HTTP server doesn't give Reason-Phrase for 200"
23 testsuccess grep 'give Reason-Phrase for' download.log
24
25 if [ "$2" = 'testsuccess' ]; then
26 testfileequal downfile 'found'
27 else
28 testfailure test -e downfile
29 fi
30}
31
32runtest() {
33 testdownload 'file works' 'testsuccess' "$1/working"
34 testdownload 'file via redirect works' 'testsuccess' "$1/redirectme/working"
35
36 testdownload 'non-existent file fails' 'testfailure' "$1/failing"
37 testdownload 'non-existent file via redirect fails' 'testfailure' "$1/redirectme/failing"
38}
39
6c0765c0
DK
40runtest "http://localhost:${APTHTTPPORT}"
41runtest "https://localhost:${APTHTTPSPORT}"