[Modify] Polish it
This commit is contained in:
parent
52f1f5c6b6
commit
959baf9ff2
@ -64,7 +64,7 @@ namespace WebSocketSharp.Net
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (len == 1 && query[0] == '?')
|
if (query == "?")
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (query[0] == '?')
|
if (query[0] == '?')
|
||||||
@ -75,15 +75,34 @@ namespace WebSocketSharp.Net
|
|||||||
|
|
||||||
var components = query.Split ('&');
|
var components = query.Split ('&');
|
||||||
foreach (var component in components) {
|
foreach (var component in components) {
|
||||||
|
len = component.Length;
|
||||||
|
if (len == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (component == "=")
|
||||||
|
continue;
|
||||||
|
|
||||||
var i = component.IndexOf ('=');
|
var i = component.IndexOf ('=');
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
ret.Add (null, HttpUtility.UrlDecode (component, encoding));
|
ret.Add (null, HttpUtility.UrlDecode (component, encoding));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
ret.Add (
|
||||||
|
null, HttpUtility.UrlDecode (component.Substring (1), encoding)
|
||||||
|
);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var name = HttpUtility.UrlDecode (component.Substring (0, i), encoding);
|
var name = HttpUtility.UrlDecode (component.Substring (0, i), encoding);
|
||||||
var val = component.Length > i + 1
|
|
||||||
? HttpUtility.UrlDecode (component.Substring (i + 1), encoding)
|
var start = i + 1;
|
||||||
|
var val = start < len
|
||||||
|
? HttpUtility.UrlDecode (
|
||||||
|
component.Substring (start), encoding
|
||||||
|
)
|
||||||
: String.Empty;
|
: String.Empty;
|
||||||
|
|
||||||
ret.Add (name, val);
|
ret.Add (name, val);
|
||||||
|
Loading…
Reference in New Issue
Block a user