X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=cgilite.sh;h=e2634240970031582aa096157702213fd6752118;hp=c00f9e7cd930674b052e3af1d49b1ebc68562cb7;hb=35d08d7e90d596c07aa8f0b5c3a62cc11231df7a;hpb=498d677f03d075567beeba90707d5b9c3b5a61fc diff --git a/cgilite.sh b/cgilite.sh index c00f9e7..e263424 100755 --- a/cgilite.sh +++ b/cgilite.sh @@ -28,22 +28,22 @@ fi cgilite_count(){ case $1 in - GET) printf %s "${QUERY_STRING}";; - POST) printf %s "?${cgilite_post}";; - REF) printf %s "?${HTTP_REFERER#*\?}";; + GET) printf %s "&${QUERY_STRING}";; + POST) printf %s "&${cgilite_post}";; + REF) printf %s "&${HTTP_REFERER#*\?}";; esac \ - | grep -Eo '[&?]'"$2"'=[^&]*' \ + | grep -Eo '&'"$2"'=[^&]*' \ | wc -l } cgilite_value(){ printf "$( case $1 in - GET) printf %s "${QUERY_STRING}";; - POST) printf %s "?${cgilite_post}";; - REF) printf %s "?${HTTP_REFERER#*\?}";; + GET) printf %s "&${QUERY_STRING}";; + POST) printf %s "&${cgilite_post}";; + REF) printf %s "&${HTTP_REFERER#*\?}";; esac \ - | grep -Eo '[&?]'"$2"'=[^&]*' \ + | grep -Eo '&'"$2"'=[^&]*' \ | sed -rn "${3:-1}"'{s;^[^=]+=;;; s;\+; ;g; s;\\;\\\\;g; s;%;\\x;g; p}' )" } @@ -111,6 +111,6 @@ SET_COOKIE(){ } REDIRECT(){ - printf 'Location: %s\r\n\r\n' "$*" + printf '%s 303 See Other\r\nLocation: %s\r\n\r\n' "$SERVER_PROTOCOL" "$*" exit 0 }