test-bug-602412-dequote-redirect 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. buildsimplenativepackage 'unrelated2' 'all' '0.5~squeeze1' 'unstable'
  9. insertinstalledpackage 'unrelated2' 'all' '0.1'
  10. setupaptarchive --no-update
  11. changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \
  12. -o aptwebserver::redirect::replace::/dists/=/newdists/
  13. mv aptarchive/pool aptarchive/newpool
  14. mv aptarchive/dists aptarchive/newdists
  15. testrun() {
  16. msgmsg "Test $1 redirection works in method boundaries" "$2"
  17. msgtest 'Test redirection works in' 'apt-get update'
  18. testsuccess --nomsg aptget update
  19. # check that I-M-S header is kept in redirections
  20. testsuccessequal "Hit:1 $2 unstable InRelease
  21. Reading package lists..." aptget update
  22. msgtest 'Test redirection works in' 'package download'
  23. testsuccess --nomsg aptget install unrelated --download-only -y
  24. }
  25. for CODE in 301 302 307; do
  26. webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
  27. testrun "$CODE" "http://localhost:${APTHTTPPORT}"
  28. testsuccess grep "^HTTP/1.1 $CODE " aptarchive/webserver.log
  29. rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
  30. done
  31. changetohttpswebserver
  32. for CODE in 301 302 307; do
  33. webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
  34. testrun "$CODE" "https://localhost:${APTHTTPSPORT}"
  35. rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
  36. done
  37. testsuccess apt update
  38. testsuccess aptget install unrelated --download-only
  39. testsuccessequal 'Reading package lists...
  40. Building dependency tree...
  41. Calculating upgrade...
  42. The following NEW packages will be installed:
  43. unrelated
  44. The following packages have been kept back:
  45. unrelated2
  46. 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
  47. Inst unrelated (0.5~squeeze1 unstable [all])
  48. Conf unrelated (0.5~squeeze1 unstable [all])' aptget dist-upgrade unrelated --no-download --fix-missing -s
  49. testsuccess aptget dist-upgrade unrelated --no-download --fix-missing -y
  50. testdpkginstalled unrelated