]> git.plutz.net Git - clickslide/commitdiff
Merge branch 'master' of plutz.net:cgilite
authorPaul Hänsch <paul@plutz.net>
Thu, 4 Apr 2019 12:09:45 +0000 (14:09 +0200)
committerPaul Hänsch <paul@plutz.net>
Thu, 4 Apr 2019 12:09:45 +0000 (14:09 +0200)
1  2 
cgilite.sh
html-sh.sed

diff --combined cgilite.sh
index 8af3eb12790b998f59d8421778aff333c619ca53,a84de140c97867d1a1fc074ac252e390dbf22c7c..7eab08a5b4bc92691b34e7cdc3e61679f2f8d2b6
@@@ -49,7 -49,7 +49,7 @@@ HEX_DECODE=
  '
  
  HEX_DECODE(){
-   printf "$(printf %s "$1" |sed -r "$HEX_DECODE")"
+   printf -- "$(printf %s "$1" |sed -r "$HEX_DECODE")"
  }
  
  if [ -z "$REQUEST_METHOD" ]; then
@@@ -116,29 -116,17 +116,29 @@@ cgilite_value()
      str=${str#*&${name}=}
      cnt=$((cnt - 1))
    done
-   printf "$(printf %s "${str%%&*}" |sed -r 's;\+; ;g;'"$HEX_DECODE")"
+   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 "$(
diff --combined html-sh.sed
index cb1c613185356b03eac15be9fd59967f3b769784,3f63b3d6fecf14dfd8808a3d58f655ff173e3040..976d42e814d4f4d836f3bb93df97653f10fd4b48
@@@ -1,4 -1,12 +1,12 @@@
- #!/bin/sed -nrf
+ #!/bin/sed -nEf
+ :Escapes
+ s,\\\\,\&#92;,g; s,\\&,\&amp;,g;
+ s,\\<,\&lt;,g; s,\\>,\&gt;,g;
+ s,\\",\&quot;,g; s,\\',\&apos;,g;
+ s,\\\[,\&#91;,g; s,\\\],\&#93;,g;
+ s,\\\.,\&#46;,g; s,\\#,\&#35;,g;
+ s,\\,,g;
  
  :CommentHandle
  x; /^<\/!-->/{
@@@ -52,8 -60,7 +60,8 @@@ s;(<select( [^>]+)?)>[ \t]*multiple;\1 
  t attribs;
  
  s;(<[^/][^>]*>)[ \t]*;\1;g;
 -s;(<[^/][^>]*)>[ \t]*</[^>]+>;\1/>;g;
 +# s;(<[^/][^>]*)>[ \t]*</[^>]+>;\1/>;g;
 +s;(<(br|hr|img|input|link|meta|area|base|col|command|embed|keygen|param|source|track|wbr)[^>]*)>[ \t]*</\1>;\1>;g;
  
  s;<!-->;<!--;;