Beispiel #1
0
        public void NL_Clear()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            coll.Clear();
        }
Beispiel #2
0
        public void NL_AddBadUri()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            coll.Add("httpblah://127.0.0.1:8181/");
        }
Beispiel #3
0
        public void NL_RemoveBadUri()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            Assert.IsFalse(coll.Remove("httpblah://127.0.0.1:8181/"));
        }
Beispiel #4
0
        ArrayList wait_queue;         // List<ListenerAsyncResult> wait_queue;

        public HttpListener()
        {
            prefixes     = new HttpListenerPrefixCollection(this);
            registry     = new Hashtable();
            ctx_queue    = new ArrayList();
            wait_queue   = new ArrayList();
            auth_schemes = AuthenticationSchemes.Anonymous;
        }
Beispiel #5
0
        public void Disposed3()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Close();
            coll.Clear();
        }
Beispiel #6
0
 public HttpListener()
 {
     prefixes     = new HttpListenerPrefixCollection(this);
     registry     = new Dictionary <HttpListenerContext, HttpListenerContext> ();
     ctx_queue    = new List <HttpListenerContext> ();
     wait_queue   = new List <ListenerAsyncResult> ();
     auth_schemes = AuthenticationSchemes.Anonymous;
 }
Beispiel #7
0
        public void Disposed4()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Close();
            coll.Remove("http://localhost:7777/hola/");
        }
Beispiel #8
0
        public void NL_DefaultProperties()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            Assert.AreEqual(0, coll.Count, "Count");
            Assert.IsFalse(coll.IsReadOnly, "IsReadOnly");
            Assert.IsFalse(coll.IsSynchronized, "IsSynchronized");
        }
Beispiel #9
0
        public void Disposed5()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Close();
            string [] strs = new string [0];
            coll.CopyTo(strs, 0);
        }
Beispiel #10
0
        public void DefaultProperties()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            coll.Add("http://127.0.0.1:8181/");
            Assert.AreEqual(1, coll.Count, "Count");
            Assert.IsFalse(coll.IsReadOnly, "IsReadOnly");
            Assert.IsFalse(coll.IsSynchronized, "IsSynchronized");
        }
Beispiel #11
0
        public void Disposed1()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Close();
            Assert.AreEqual(0, coll.Count, "Count");
            Assert.IsFalse(coll.IsReadOnly, "IsReadOnly");
            Assert.IsFalse(coll.IsSynchronized, "IsSynchronized");
        }
Beispiel #12
0
 public HttpListener()
 {
     prefixes                 = new HttpListenerPrefixCollection(this);
     registry                 = new Hashtable();
     connections              = Hashtable.Synchronized(new Hashtable());
     ctx_queue                = new ArrayList();
     wait_queue               = new ArrayList();
     auth_schemes             = AuthenticationSchemes.Anonymous;
     defaultServiceNames      = new ServiceNameStore();
     extendedProtectionPolicy = new ExtendedProtectionPolicy(PolicyEnforcement.Never);
 }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpListener"/> class.
 /// </summary>
 public HttpListener()
 {
     _prefixes    = new HttpListenerPrefixCollection(this);
     _registry    = new Hashtable();
     _connections = Hashtable.Synchronized(new Hashtable());
     _ctxQueue    = new ArrayList();
     _waitQueue   = new ArrayList();
     _authSchemes = AuthenticationSchemes.Anonymous;
     //defaultServiceNames = new ServiceNameStore();
     //_extendedProtectionPolicy = new ExtendedProtectionPolicy(PolicyEnforcement.Never);
 }
Beispiel #14
0
        public void AddOne()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Start();
            coll.Add("http://127.0.0.1:8181/");
            Assert.AreEqual(1, coll.Count, "Count");
            Assert.IsFalse(coll.IsReadOnly, "IsReadOnly");
            Assert.IsFalse(coll.IsSynchronized, "IsSynchronized");
            listener.Stop();
        }
Beispiel #15
0
        public void PercentSign()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            // this one throws on Start(), not when adding it.
            // See same test name in HttpListenerTest.
            coll.Add("http://localhost:7777/hola%3E/");
            string [] strs = new string [1];
            coll.CopyTo(strs, 0);
            Assert.AreEqual("http://localhost:7777/hola%3E/", strs [0]);
        }
Beispiel #16
0
        public HttpListener()
        {
            _state               = State.Stopped;
            _internalLock        = new object();
            _defaultServiceNames = new ServiceNameStore();

            _timeoutManager = new HttpListenerTimeoutManager(this);
            _prefixes       = new HttpListenerPrefixCollection(this);

            // default: no CBT checks on any platform (appcompat reasons); applies also to PolicyEnforcement
            // config element
            _extendedProtectionPolicy = new ExtendedProtectionPolicy(PolicyEnforcement.Never);
        }
        public void AddOne()
        {
            var          port     = NetworkHelpers.FindFreePort();
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Start();
            coll.Add($"http://127.0.0.1:{port}/");
            Assert.AreEqual(1, coll.Count, "Count");
            Assert.IsFalse(coll.IsReadOnly, "IsReadOnly");
            Assert.IsFalse(coll.IsSynchronized, "IsSynchronized");
            listener.Stop();
        }
Beispiel #18
0
        public void Disposed6()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Close();
            string a = null;

            foreach (string s in coll)
            {
                a = s;                 // just to make the compiler happy
            }
            Assert.IsNull(a);
        }
Beispiel #19
0
        public void Disposed7()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            coll.Add("http://127.0.0.1/");
            listener.Close();
            int items = 0;

            foreach (string s in coll)
            {
                items++;
                Assert.AreEqual(s, "http://127.0.0.1/");
            }
            Assert.AreEqual(items, 1);
        }