]> git.plutz.net Git - cgilite/commitdiff
faster hexdecode for mixed data (e.g. post-data)
authorPaul Hänsch <paul@plutz.net>
Thu, 24 Mar 2022 11:45:06 +0000 (12:45 +0100)
committerPaul Hänsch <paul@plutz.net>
Thu, 24 Mar 2022 11:45:06 +0000 (12:45 +0100)
cgilite.sh

index 90d65577648d2d78efa7d349e90677984f87c436..6cbd7ec27eca272bff82a98bcf08fb2b24d55a46 100755 (executable)
@@ -89,7 +89,8 @@ HEX_DECODE(){
       "$pfx"[0-9a-fA-F][0-9a-fA-F]*) in="${in#${pfx}}";;
       \\*) in="${in#?}"; out="${out}\\\\"; continue;;
        %*) in="${in#?}"; out="${out}%%";  continue;;
-        *) out="${out}${in%"${in#?}"}"; in="${in#?}"; continue;;
+        *) att="${in%%"${pfx}"*}"; att="${att%%%*}"; att="${att%%\\*}"
+           out="${out}${att}"; in="${in#"${att}"}"; continue;;
     esac;
 
     # Hex escapes for printf (e.g. \x41) are not portable