コード例 #1
0
        private void processRequest(TcpListenerWebSocketContext context)
        {
            var uri = context.RequestUri;

            if (uri == null)
            {
                context.Close(HttpStatusCode.BadRequest);
                return;
            }

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

                if (!checkHostNameForRequest(uri.DnsSafeHost))
                {
                    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);
        }