You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.3 KiB

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