Merge pull request #73 from ngocdaothanh/master

QueryStringDecoder should also support ; Fix for #72
This commit is contained in:
Norman Maurer 2011-11-22 22:08:31 -08:00
commit b5f8ff3003

View File

@ -30,9 +30,11 @@ import org.jboss.netty.util.CharsetUtil;
* Splits an HTTP query string into a path string and key-value parameter pairs.
* This decoder is for one time use only. Create a new instance for each URI:
* <pre>
* {@link QueryStringDecoder} decoder = new {@link QueryStringDecoder}("/hello?recipient=world");
* {@link QueryStringDecoder} decoder = new {@link QueryStringDecoder}("/hello?recipient=world&x=1;y=2");
* assert decoder.getPath().equals("/hello");
* assert decoder.getParameters().get("recipient").equals("world");
* assert decoder.getParameters().get("x").equals("1");
* assert decoder.getParameters().get("y").equals("2");
* </pre>
*
* @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
@ -73,7 +75,8 @@ public class QueryStringDecoder {
throw new NullPointerException("charset");
}
this.uri = uri;
// http://en.wikipedia.org/wiki/Query_string
this.uri = uri.replace(';', '&');
this.charset = charset;
}
@ -97,7 +100,8 @@ public class QueryStringDecoder {
throw new NullPointerException("charset");
}
this.uri = uri.toASCIIString();
// http://en.wikipedia.org/wiki/Query_string
this.uri = uri.toASCIIString().replace(';', '&');
this.charset = charset;
}