[Modify] Polish it
This commit is contained in:
parent
34868bed04
commit
d8eaefc3c7
@ -1124,38 +1124,47 @@ namespace WebSocketSharp.Server
|
|||||||
message = null;
|
message = null;
|
||||||
|
|
||||||
var uri = uriString.ToUri ();
|
var uri = uriString.ToUri ();
|
||||||
|
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
message = "An invalid URI string.";
|
message = "An invalid URI string.";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!uri.IsAbsoluteUri) {
|
if (!uri.IsAbsoluteUri) {
|
||||||
message = "A relative URI.";
|
message = "A relative URI.";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var schm = uri.Scheme;
|
var schm = uri.Scheme;
|
||||||
|
|
||||||
if (!(schm == "http" || schm == "https")) {
|
if (!(schm == "http" || schm == "https")) {
|
||||||
message = "The scheme part is not 'http' or 'https'.";
|
message = "The scheme part is not 'http' or 'https'.";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uri.PathAndQuery != "/") {
|
if (uri.PathAndQuery != "/") {
|
||||||
message = "It includes either or both path and query components.";
|
message = "It includes either or both path and query components.";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uri.Fragment.Length > 0) {
|
if (uri.Fragment.Length > 0) {
|
||||||
message = "It includes the fragment component.";
|
message = "It includes the fragment component.";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uri.Port == 0) {
|
if (uri.Port == 0) {
|
||||||
message = "The port part is zero.";
|
message = "The port part is zero.";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = uri;
|
result = uri;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user