test-apt-https-no-redirect 1.1 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
  11. webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/"
  12. webserverconfig 'aptwebserver::redirect::replace::/redirectme2/' "https://localhost:${APTHTTPSPORT}/"
  13. msgtest 'download of a file works via' 'http'
  14. testsuccess --nomsg downloadfile "http://localhost:${APTHTTPPORT}/working" httpfile
  15. testfileequal httpfile 'alright'
  16. msgtest 'download of a file works via' 'https'
  17. testsuccess --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/working" httpsfile
  18. testfileequal httpsfile 'alright'
  19. msgtest 'download of a file does not work if' 'https redirected to http'
  20. testfailure --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/redirectme/working" redirectfile
  21. msgtest 'libcurl has forbidden access in last request to' 'http resource'
  22. testsuccess --nomsg grep -q -E -- "Redirection from https to 'http://.*' is forbidden" rootdir/tmp/testfailure.output