test-bug-602412-dequote-redirect 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. rm -f aptarchive/webserver.log.client*.log
  28. testrun "$CODE" "http://localhost:${APTHTTPPORT}"
  29. testsuccess grep "^HTTP/1.1 $CODE " aptarchive/webserver.log.client*.log
  30. rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
  31. done
  32. changetohttpswebserver
  33. for CODE in 301 302 307; do
  34. webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
  35. rm -f aptarchive/webserver.log.client*.log
  36. testrun "$CODE" "https://localhost:${APTHTTPSPORT}"
  37. testsuccess grep "^HTTP/1.1 $CODE " aptarchive/webserver.log.client*.log
  38. rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
  39. done
  40. testsuccess apt update
  41. testsuccess aptget install unrelated --download-only
  42. testsuccessequal 'Reading package lists...
  43. Building dependency tree...
  44. Calculating upgrade...
  45. The following NEW packages will be installed:
  46. unrelated
  47. The following packages have been kept back:
  48. unrelated2
  49. 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
  50. Inst unrelated (0.5~squeeze1 unstable [all])
  51. Conf unrelated (0.5~squeeze1 unstable [all])' aptget dist-upgrade unrelated --no-download --fix-missing -s
  52. testsuccess aptget dist-upgrade unrelated --no-download --fix-missing -y
  53. testdpkginstalled unrelated