summaryrefslogtreecommitdiffstats
path: root/test/integration/test-bug-778375-server-has-no-reason-phrase
blob: e04f4850fa5a0d24f31d79e648d68c6cb03db69e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"

setupenvironment
configarchitecture 'native'

echo 'found' > aptarchive/working
changetohttpswebserver  -o 'aptwebserver::redirect::replace::/redirectme/=/' \
	-o 'aptwebserver::httpcode::200=200' -o 'aptwebserver::httpcode::404=404' \
	-o 'aptwebserver::httpcode::301=301'
webserverconfig 'aptwebserver::empty-response-header::' 'foobar'
webserverconfig 'aptwebserver::response-header::HTTP-Trigger-Field' 'bug'
webserverconfig 'aptwebserver::response-header::Httputter-Trigger-Field' 'bug'

testdownload() {
	rm -f downfile
	msgtest "download of a $1 via" "${3%%:*}"
	$2 --nomsg downloadfile "$3" downfile

	cp rootdir/tmp/testsuccess.output download.log
	#looking for "HTTP server doesn't give Reason-Phrase for 200"
	testsuccess grep 'give Reason-Phrase for' download.log

	if [ "$2" = 'testsuccess' ]; then
		testfileequal downfile 'found'
	else
		testfailure test -e downfile
	fi
}

runtest() {
	testdownload 'file works' 'testsuccess' "$1/working"
	testdownload 'file via redirect works' 'testsuccess' "$1/redirectme/working"

	testdownload 'non-existent file fails' 'testfailure' "$1/failing"
	testdownload 'non-existent file via redirect fails' 'testfailure' "$1/redirectme/failing"
}

runtest "http://localhost:${APTHTTPPORT}"
runtest "https://localhost:${APTHTTPSPORT}"