コード例 #1
0
        public void NL_Clear()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

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

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

            Assert.IsFalse(coll.Remove("httpblah://127.0.0.1:8181/"));
        }
コード例 #4
0
ファイル: HttpListener.cs プロジェクト: raj581/Marvin
        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;
        }
コード例 #5
0
        public void Disposed3()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Close();
            coll.Clear();
        }
コード例 #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;
 }
コード例 #7
0
        public void Disposed4()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Close();
            coll.Remove("http://localhost:7777/hola/");
        }
コード例 #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");
        }
コード例 #9
0
        public void Disposed5()
        {
            HttpListener listener = new HttpListener();
            HLPC         coll     = listener.Prefixes;

            listener.Close();
            string [] strs = new string [0];
            coll.CopyTo(strs, 0);
        }
コード例 #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");
        }
コード例 #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");
        }
コード例 #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);
 }
コード例 #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);
 }
コード例 #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();
        }
コード例 #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]);
        }
コード例 #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);
        }
コード例 #17
0
        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();
        }
コード例 #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);
        }
コード例 #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);
        }