diff --git a/core/src/main/java/com/bj58/argo/thirdparty/jetty/UrlEncoded.java b/core/src/main/java/com/bj58/argo/thirdparty/jetty/UrlEncoded.java index 9850877..12b5ced 100644 --- a/core/src/main/java/com/bj58/argo/thirdparty/jetty/UrlEncoded.java +++ b/core/src/main/java/com/bj58/argo/thirdparty/jetty/UrlEncoded.java @@ -190,67 +190,68 @@ public static void decodeTo(String content, MultiMap map, Charset charse { if (charset==null) charset=ENCODING; - - synchronized(map) - { - String key = null; - String value = null; - int mark=-1; - boolean encoded=false; - for (int i=0;i0) - { - map.add(value,""); - } - key = null; - value=null; - if (maxKeys>0 && map.size()>maxKeys) - throw new IllegalStateException("Form too many keys"); - break; - case '=': - if (key!=null) + char c = content.charAt(i); + switch (c) + { + case '&': + int l=i-mark-1; + value = l==0?"": + (encoded?decodeString(content,mark+1,l,charset):content.substring(mark+1,i)); + mark=i; + encoded=false; + if (key != null) + { + map.add(key,value); + } + else if (value!=null&&value.length()>0) + { + map.add(value,""); + } + key = null; + value=null; + if (maxKeys>0 && map.size()>maxKeys) + throw new IllegalStateException("Form too many keys"); break; - key = encoded?decodeString(content,mark+1,i-mark-1,charset):content.substring(mark+1,i); - mark=i; - encoded=false; - break; - case '+': - encoded=true; - break; - case '%': - encoded=true; - break; - } - } - - if (key != null) - { - int l=content.length()-mark-1; - value = l==0?"":(encoded?decodeString(content,mark+1,l,charset):content.substring(mark+1)); - map.add(key,value); - } - else if (mark 0) + case '=': + if (key!=null) + break; + key = encoded?decodeString(content,mark+1,i-mark-1,charset):content.substring(mark+1,i); + mark=i; + encoded=false; + break; + case '+': + encoded=true; + break; + case '%': + encoded=true; + break; + } + } + + if (key != null) + { + int l=content.length()-mark-1; + value = l==0?"":(encoded?decodeString(content,mark+1,l,charset):content.substring(mark+1)); + map.add(key,value); + } + else if (mark 0) + { + map.add(key,""); + } } } } @@ -1017,4 +1018,4 @@ public static byte convertHexDigit( byte c ) throw new IllegalArgumentException("!hex "+c); return b; } -} \ No newline at end of file +}