X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=cgilite.sh;h=7eab08a5b4bc92691b34e7cdc3e61679f2f8d2b6;hp=3212137e68bcb262b338256d29b29d952c3ca9d1;hb=e2678dc719c2dcda2de9a6079ac63837681e1a26;hpb=2509a90ca35ffada128256670abf1d5c315ef6ce diff --git a/cgilite.sh b/cgilite.sh index 3212137..7eab08a 100755 --- a/cgilite.sh +++ b/cgilite.sh @@ -92,7 +92,7 @@ if [ -z "$REQUEST_METHOD" ]; then "$cgilite_response" "${cgilite_cl}" cat [ "${cgilite_cl#Connection}" = "${cgilite_cl}" ]; exit;; - *) cgilite_response="$cgilite_response${BR}$l";; + *) cgilite_response="${cgilite_response:+${cgilite_response}${BR}}${l}";; esac; done || exit 0; (sleep $cgilite_timeout && kill $$) & cgilite_watchdog=$! done @@ -119,14 +119,26 @@ cgilite_value(){ printf -- "$(printf %s "${str%%&*}" |sed -r 's;\+; ;g;'"$HEX_DECODE")" } +cgilite_keys(){ + local str="&$1" + while [ "${str#*&}" != "${str}" ]; do + str="${str#*&}" + printf '%s\n' "${str%%=*}" + done \ + | sort -u +} + GET(){ cgilite_value "${QUERY_STRING}" $@; } GET_COUNT(){ cgilite_count "${QUERY_STRING}" $1; } +GET_KEYS(){ cgilite_keys "${QUERY_STRING}"; } POST(){ cgilite_value "${cgilite_post}" $@; } POST_COUNT(){ cgilite_count "${cgilite_post}" $1; } +POST_KEYS(){ cgilite_keys "${cgilite_post}"; } REF(){ cgilite_value "${HTTP_REFERER#*\?}" $@; } REF_COUNT(){ cgilite_count "${HTTP_REFERER#*\?}" $1; } +REF_KEYS(){ cgilite_keys "${HTTP_REFERER#*\?}"; } COOKIE(){ HEX_DECODE "$(