You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
2.0 KiB

  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. echo 'Dir::Bin::Methods::https+http "http";' > rootdir/etc/apt/apt.conf.d/99add-https-http-method
  14. echo 'Dir::Bin::Methods::foo+https "http";' > rootdir/etc/apt/apt.conf.d/99add-foo-https-method
  15. msgtest 'download of a file works via' 'http'
  16. testsuccess --nomsg downloadfile "http://localhost:${APTHTTPPORT}/working" httpfile
  17. testfileequal httpfile 'alright'
  18. msgtest 'download of a file works via' 'https'
  19. testsuccess --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/working" httpsfile
  20. testfileequal httpsfile 'alright'
  21. rm -f httpfile httpsfile
  22. msgtest 'download of http file works via' 'https+http'
  23. testsuccess --nomsg downloadfile "https+http://localhost:${APTHTTPPORT}/working" httpfile
  24. testfileequal httpfile 'alright'
  25. rm -f httpfile
  26. msgtest 'download of a file does not work if' 'https redirected to http'
  27. testfailure --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/redirectme/working" redirectfile
  28. msgtest 'libcurl has forbidden access in last request to' 'http resource'
  29. testsuccess --nomsg grep -q -E -- "Redirection from https to 'http://.*' is forbidden" rootdir/tmp/testfailure.output
  30. rm -f redirectfile
  31. msgtest 'download of a file does work if' 'https+http redirected to https'
  32. testsuccess --nomsg downloadfile "https+http://localhost:${APTHTTPPORT}/redirectme2/working" redirectfile
  33. testfileequal redirectfile 'alright'
  34. rm -f redirectfile
  35. msgtest 'download of a file does work if' 'foo+https redirected to https'
  36. testsuccess --nomsg downloadfile "foo+https://localhost:${APTHTTPSPORT}/redirectme2/working" redirectfile
  37. testfileequal redirectfile 'alright'
  38. rm -f redirectfile