test-apt-https-no-redirect 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. insertpackage 'stable' 'apt' 'all' '1'
  8. setupaptarchive --no-update
  9. echo 'alright' > aptarchive/working
  10. changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/'
  11. msgtest 'download of a file works via' 'http'
  12. downloadfile 'http://localhost:8080/working' httpfile >/dev/null 2>&1 && msgpass || msgfail
  13. testfileequal httpfile 'alright'
  14. msgtest 'download of a file works via' 'https'
  15. downloadfile 'https://localhost:4433/working' httpsfile >/dev/null 2>&1 && msgpass || msgfail
  16. testfileequal httpsfile 'alright'
  17. msgtest 'download of a file does not work if' 'https redirected to http'
  18. downloadfile 'https://localhost:4433/redirectme/working' redirectfile >curloutput 2>&1 && msgfail || msgpass
  19. msgtest 'libcurl has forbidden access in last request to' 'http resource'
  20. grep -q -- 'Protocol http not supported or disabled in libcurl' curloutput && msgpass || msgfail