case "$1" in
''|0|session) expire='';;
[+-][0-9]*) expire="$(date -R -d @$(($(date +%s) + $1)))";;
- *) expire="$(date -R -d "$1")";;
+ *) expire="$(date -R -d "$1")";;
esac
cookie="$2"
-
+
printf 'Set-Cookie: %s' "$cookie"
- [ -n "$expire" ] && printf '; Expires=%s' "$expire"
+ [ -n "$expire" ] && printf '; Expires=%s' "${expire%+????}${expire:+GMT}"
[ $# -ge 3 ] && shift 2 && printf '; %s' "$@"
printf '\r\n'
}
REDIRECT(){
- printf 'Status: 303 See Other\r\nLocation: %s\r\n\r\n' "$*"
+ printf '%s: %s\r\n'
+ Status "303 See Other" \
+ Content-Length 0 \
+ Location "$*"
+ printf '\r\n'
exit 0
}
-