[Modify] Throw exceptions
This commit is contained in:
@@ -114,8 +114,22 @@ namespace WebSocketSharp.Server
|
|||||||
/// </param>
|
/// </param>
|
||||||
public WebSocketServiceHost this[string path] {
|
public WebSocketServiceHost this[string path] {
|
||||||
get {
|
get {
|
||||||
|
if (path == null)
|
||||||
|
throw new ArgumentNullException ("path");
|
||||||
|
|
||||||
|
if (path.Length == 0)
|
||||||
|
throw new ArgumentException ("An empty string.", "path");
|
||||||
|
|
||||||
|
if (path[0] != '/')
|
||||||
|
throw new ArgumentException ("Not an absolute path.", "path");
|
||||||
|
|
||||||
|
if (path.IndexOfAny (new[] { '?', '#' }) > -1) {
|
||||||
|
var msg = "It includes either or both query and fragment components.";
|
||||||
|
throw new ArgumentException (msg, "path");
|
||||||
|
}
|
||||||
|
|
||||||
WebSocketServiceHost host;
|
WebSocketServiceHost host;
|
||||||
TryGetServiceHost (path, out host);
|
InternalTryGetServiceHost (path, out host);
|
||||||
|
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user