test-bug-602412-dequote-redirect 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
  8. setupaptarchive --no-update
  9. changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \
  10. -o aptwebserver::redirect::replace::/dists/=/newdists/
  11. mv aptarchive/pool aptarchive/newpool
  12. mv aptarchive/dists aptarchive/newdists
  13. testrun() {
  14. msgmsg "Test $1 redirection works in method boundaries" "$2"
  15. msgtest 'Test redirection works in' 'apt-get update'
  16. testsuccess --nomsg aptget update
  17. # check that I-M-S header is kept in redirections
  18. testsuccessequal "Hit:1 $2 unstable InRelease
  19. Reading package lists..." aptget update
  20. msgtest 'Test redirection works in' 'package download'
  21. testsuccess --nomsg aptget install unrelated --download-only -y
  22. }
  23. for CODE in 301 302 307; do
  24. webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
  25. testrun "$CODE" "http://localhost:${APTHTTPPORT}"
  26. testsuccess grep "^HTTP/1.1 $CODE " aptarchive/webserver.log
  27. rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
  28. done
  29. changetohttpswebserver
  30. for CODE in 301 302 307; do
  31. webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
  32. testrun "$CODE" "https://localhost:${APTHTTPSPORT}"
  33. rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
  34. done