Exemple #1
0
        private void processWebSocketRequest(TcpListenerWebSocketContext context)
        {
            var uri = context.RequestUri;

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

            if (_uri.IsAbsoluteUri)
            {
                var actual   = uri.DnsSafeHost;
                var expected = _uri.DnsSafeHost;
                if (Uri.CheckHostName(actual) == UriHostNameType.Dns &&
                    Uri.CheckHostName(expected) == UriHostNameType.Dns &&
                    actual != expected)
                {
                    context.Close(HttpStatusCode.NotFound);
                    return;
                }
            }

            WebSocketServiceHost host;

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

            host.StartSession(context);
        }
Exemple #2
0
        private void processWebSocketRequest(HttpListenerWebSocketContext context)
        {
            WebSocketServiceHost host;

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

            host.StartSession(context);
        }
        private void acceptWebSocketRequest(HttpListenerWebSocketContext context)
        {
            var path = context.Path;

            WebSocketServiceHost host;

            if (path == null || !_services.TryGetServiceHostInternally(path, out host))
            {
                context.Close(HttpStatusCode.NotImplemented);
                return;
            }

            host.StartSession(context);
        }
Exemple #4
0
        private void acceptWebSocket(TcpListenerWebSocketContext context)
        {
            var path = context.Path;

            WebSocketServiceHost host;

            if (path == null || !_services.TryGetServiceHostInternally(path, out host))
            {
                context.Close(HttpStatusCode.NotImplemented);
                return;
            }

            if (_uri.IsAbsoluteUri)
            {
                context.WebSocket.Url = new Uri(_uri, path);
            }

            host.StartSession(context);
        }