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

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. webserverconfig 'aptwebserver::empty-response-header::' 'foobar'
  12. testdownload() {
  13. rm -f downfile
  14. msgtest "download of a $1 via" "${3%%:*}"
  15. $2 --nomsg downloadfile "$3" downfile
  16. cp rootdir/tmp/testsuccess.output download.log
  17. #looking for "HTTP server doesn't give Reason-Phrase for 200"
  18. testsuccess grep 'give Reason-Phrase for' download.log
  19. if [ "$2" = 'testsuccess' ]; then
  20. testfileequal downfile 'found'
  21. else
  22. testfailure test -e downfile
  23. fi
  24. }
  25. runtest() {
  26. testdownload 'file works' 'testsuccess' "$1/working"
  27. testdownload 'file via redirect works' 'testsuccess' "$1/redirectme/working"
  28. testdownload 'non-existent file fails' 'testfailure' "$1/failing"
  29. testdownload 'non-existent file via redirect fails' 'testfailure' "$1/redirectme/failing"
  30. }
  31. runtest "http://localhost:${APTHTTPPORT}"
  32. runtest "https://localhost:${APTHTTPSPORT}"