private void processRequest(TcpListenerWebSocketContext context)
        {
            var uri = context.RequestUri;

            if (uri == null || uri.Port != _port)
            {
                context.Close(HttpStatusCode.BadRequest);
                return;
            }

            if (_dnsStyle)
            {
                var hostname = uri.DnsSafeHost;
                if (Uri.CheckHostName(hostname) == UriHostNameType.Dns && hostname != _hostname)
                {
                    context.Close(HttpStatusCode.NotFound);
                    return;
                }
            }

            WebSocketServiceHost host;

            if (!_services.InternalTryGetServiceHost(uri.AbsolutePath, out host))
            {
                context.Close(HttpStatusCode.NotImplemented);
                return;
            }

            host.StartSession(context);
        }
示例#2
0
        private void processRequest(HttpListenerWebSocketContext context)
        {
            WebSocketServiceHost host;

            if (!_services.InternalTryGetServiceHost(context.RequestUri.AbsolutePath, out host))
            {
                context.Close(HttpStatusCode.NotImplemented);
                return;
            }

            host.StartSession(context);
        }