[Modify] Polish it

This commit is contained in:
sta 2020-12-28 19:48:27 +09:00
parent 571db9f76a
commit 747361a86f

View File

@ -914,18 +914,23 @@ namespace WebSocketSharp.Server
private void processRequest (HttpListenerWebSocketContext context) private void processRequest (HttpListenerWebSocketContext context)
{ {
var uri = context.RequestUri; var uri = context.RequestUri;
if (uri == null) { if (uri == null) {
context.Close (HttpStatusCode.BadRequest); context.Close (HttpStatusCode.BadRequest);
return; return;
} }
var path = uri.AbsolutePath; var path = uri.AbsolutePath;
if (path.IndexOfAny (new[] { '%', '+' }) > -1) if (path.IndexOfAny (new[] { '%', '+' }) > -1)
path = HttpUtility.UrlDecode (path, Encoding.UTF8); path = HttpUtility.UrlDecode (path, Encoding.UTF8);
WebSocketServiceHost host; WebSocketServiceHost host;
if (!_services.InternalTryGetServiceHost (path, out host)) { if (!_services.InternalTryGetServiceHost (path, out host)) {
context.Close (HttpStatusCode.NotImplemented); context.Close (HttpStatusCode.NotImplemented);
return; return;
} }