test_setup()
{
    request=$'/foo.cgi\tping\r\n'

    # In (D)CGI scripts, only the variable $REMOTE_HOST is present. It
    # holds the contents of either $REMOTE_HOST or $REMOTE_ADDR, as set
    # by the daemon invoking sgopherd -- but $REMOTE_ADDR takes
    # precdence, for historic reasons.
    remote_addr=testsuite.remote.addr
    remote_host=testsuite.remote.host

    cat >"$docroot"/foo.cgi <<EOF
#!/bin/sh

printf '%s' "\$REMOTE_HOST"
EOF
    chmod +x "$docroot"/foo.cgi
}

test_set_assumptions()
{
    echo 0 >"$work"/exitcode.expected
    touch "$work"/stderr.expected

    printf '%s' testsuite.remote.addr >"$work"/stdout.expected
}
