From f2f8e89f08cdf01c83a0b8ab053c65329d85ca90 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 26 Jul 2017 18:35:42 +0200 Subject: fail early in http if server answer is too small as well Failing on too much data is good, but we can do better by checking for exact filesizes as we know with hashsums how large a file should be, so if we get a file which has a size we do not expect we can drop it directly, regardless of if the file is larger or smaller than what we expect which should catch most cases which would end up as hashsum errors later now a lot sooner. --- test/integration/test-apt-update-hashsum-mismatch | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'test/integration/test-apt-update-hashsum-mismatch') diff --git a/test/integration/test-apt-update-hashsum-mismatch b/test/integration/test-apt-update-hashsum-mismatch index 4d4c33286..48d041a15 100755 --- a/test/integration/test-apt-update-hashsum-mismatch +++ b/test/integration/test-apt-update-hashsum-mismatch @@ -15,12 +15,6 @@ insertsource 'testing' 'foo2' 'all' '1' setupaptarchive --no-update changetowebserver -echo 'Package: bar -Maintainer: Doctor Evil -Description: come to the dark side -' > aptarchive/DoctorEvil -compressfile aptarchive/DoctorEvil - find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete testsuccess aptget update @@ -29,9 +23,8 @@ testsuccess aptget install foo -s for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log.client*.log); do msgmsg 'Test hashsum mismatch with file' "$get" + breakfiles "aptarchive/${get}" rm -rf rootdir/var/lib/apt/lists - webserverconfig 'aptwebserver::overwrite' '' - webserverconfig "aptwebserver::overwrite::$(printf '%s' "${get}" | sed 's#/#%2F#g' )::filename" '%2FDoctorEvil.gz' testfailure aptget update cp rootdir/tmp/testfailure.output rootdir/tmp/update.output @@ -41,4 +34,6 @@ for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver. testfailure aptcache show bar testfailure aptget install bar -s + + unbreakfiles "aptarchive/${get}" done -- cgit v1.2.3