test-bug-778375-server-has-no-reason-phrase 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'native'
  7. echo 'found' > aptarchive/working
  8. changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=/' \
  9. -o 'aptwebserver::httpcode::200=200' -o 'aptwebserver::httpcode::404=404' \
  10. -o 'aptwebserver::httpcode::301=301'
  11. testdownload() {
  12. rm -f downfile
  13. msgtest "download of a $1 via" "${3%%:*}"
  14. $2 --nomsg downloadfile "$3" downfile
  15. cp rootdir/tmp/testsuccess.output download.log
  16. #looking for "HTTP server doesn't give Reason-Phrase for 200"
  17. testsuccess grep 'give Reason-Phrase for' download.log
  18. if [ "$2" = 'testsuccess' ]; then
  19. testfileequal downfile 'found'
  20. else
  21. testfailure test -e downfile
  22. fi
  23. }
  24. runtest() {
  25. testdownload 'file works' 'testsuccess' "$1/working"
  26. testdownload 'file via redirect works' 'testsuccess' "$1/redirectme/working"
  27. testdownload 'non-existent file fails' 'testfailure' "$1/failing"
  28. testdownload 'non-existent file via redirect fails' 'testfailure' "$1/redirectme/failing"
  29. }
  30. runtest "http://localhost:${APTHTTPPORT}"
  31. runtest "https://localhost:${APTHTTPSPORT}"