AddPrefix() public method

public AddPrefix ( System.Net.ListenerPrefix prefix, HttpListener listener ) : void
prefix System.Net.ListenerPrefix
listener HttpListener
return void
Ejemplo n.º 1
0
        private static void AddPrefixInternal(string p, HttpListener listener)
        {
            ListenerPrefix listenerPrefix = new ListenerPrefix(p);

            if (listenerPrefix.Path.IndexOf('%') != -1)
            {
                throw new HttpListenerException(400, "Invalid path.");
            }
            if (listenerPrefix.Path.IndexOf("//") != -1)
            {
                throw new HttpListenerException(400, "Invalid path.");
            }
            EndPointListener eplistener = EndPointManager.GetEPListener(IPAddress.Any, listenerPrefix.Port, listener, listenerPrefix.Secure);

            eplistener.AddPrefix(listenerPrefix, listener);
        }
Ejemplo n.º 2
0
        static void AddPrefixInternal(string p, HttpListener listener)
        {
            ListenerPrefix lp = new ListenerPrefix(p);

            if (lp.Path.IndexOf('%') != -1)
            {
                throw new HttpListenerException(400, "Invalid path.");
            }

            if (lp.Path.IndexOf("//") != -1)              // TODO: Code?
            {
                throw new HttpListenerException(400, "Invalid path.");
            }

            // Always listens on all the interfaces, no matter the host name/ip used.
            EndPointListener epl = GetEPListener(IPAddress.Any, lp.Port, listener, lp.Secure);

            epl.AddPrefix(lp, listener);
        }
Ejemplo n.º 3
0
        static void AddPrefixInternal(string p, HttpListener listener)
        {
            ListenerPrefix lp = new ListenerPrefix(p);

            if (lp.Path.IndexOf('%') != -1)
            {
                throw new HttpListenerException(400, "Invalid path.");
            }

            if (lp.Path.IndexOf("//", StringComparison.Ordinal) != -1)              // TODO: Code?
            {
                throw new HttpListenerException(400, "Invalid path.");
            }

            // listens on all the interfaces if host name cannot be parsed by IPAddress.
            EndPointListener epl = GetEPListener(lp.Host, lp.Port, listener, lp.Secure);

            epl.AddPrefix(lp, listener);
        }