diff --git a/websocket-sharp/Server/WebSocketServiceManager.cs b/websocket-sharp/Server/WebSocketServiceManager.cs index 553bb19d..b80826dc 100644 --- a/websocket-sharp/Server/WebSocketServiceManager.cs +++ b/websocket-sharp/Server/WebSocketServiceManager.cs @@ -963,17 +963,21 @@ namespace WebSocketSharp.Server if (path.Length == 0) throw new ArgumentException ("An empty string.", "path"); - if (path[0] != '/') - throw new ArgumentException ("Not an absolute path.", "path"); + if (path[0] != '/') { + var msg = "It is not an absolute path."; + + throw new ArgumentException (msg, "path"); + } if (path.IndexOfAny (new[] { '?', '#' }) > -1) { var msg = "It includes either or both query and fragment components."; + throw new ArgumentException (msg, "path"); } path = path.TrimSlashFromEnd (); - WebSocketServiceHost host; + lock (_sync) { if (!_hosts.TryGetValue (path, out host)) return false;