[Modify] Polish it

This commit is contained in:
sta 2017-02-08 16:00:54 +09:00
parent 8614a891f0
commit 47dfbe62df

View File

@ -608,13 +608,16 @@ namespace WebSocketSharp.Server
/// </param>
public bool TryGetServiceHost (string path, out WebSocketServiceHost host)
{
var msg = _state.CheckIfAvailable (false, true, false) ?? path.CheckIfValidServicePath ();
if (msg != null) {
_logger.Error (msg);
host = null;
if (path == null || path.Length == 0)
return false;
if (path[0] != '/')
return false;
if (path.IndexOfAny (new[] { '?', '#' }) > -1)
return false;
}
return InternalTryGetServiceHost (path, out host);
}