#!/bin/sh

set -eu

REQUIRED_CMDLINE="-c examples/minimal.conf"
. regression.inc

HOST="localhost"
WPATH="/"

NAME="check Not Implemented"
CODE=${BAD_CODE}
METHODS=${BAD_METHODS}
do_request
unset METHODS

NAME="check ${WPATH}"
CODE=200
do_request

WPATH="//"
NAME="check ${WPATH}"
CODE=200
do_request

WPATH="///"
NAME="check ${WPATH}"
CODE=200
do_request

WPATH="/status"
NAME="check ${WPATH}"
CODE=200
do_request

WPATH="/../etc/passwd"
NAME="check ${WPATH}"
CODE=404
do_request

NAME="check uri decode plus / redirect"
WPATH="/+with+space+s"
CODE=301
do_request

NAME="check uri decode plus"
WPATH="/+with+space+s/"
CODE=200
do_request

NAME="check uri decode percent"
WPATH="/%20with%20space%20s/"
CODE=200
do_request

NAME="check bad uri"
WPATH="/with^nonescapedcaret/"
CODE=400
do_request

NAME="check strong url 0"
WPATH="/'+deployAd[i].url+'"
CODE=400
do_request

NAME="check utf8/été.html"
WPATH="/utf8/%C3%A9t%C3%A9.html"
CODE=200
do_request

echo "All tests passed"
