Esempio n. 1
0
        public void TestIsValid()
        {
            string requestLine = "GET FDFDadf HTTP/1.1\r\nHeaderFejils:dfdf::jfjek:\r\n\r\n";

            byte[] byteArray = Encoding.UTF8.GetBytes(requestLine);
            //byte[] byteArray = Encoding.ASCII.GetBytes(contents);
            MemoryStream stream = new MemoryStream(byteArray);

            WebServer.Reset();

            Assert.IsTrue(WebServer.IsVaid(stream));

            requestLine = "GET FDFDadf HTTP/1.1\r\n HeaderFejils:dfdf::jfjek:\r\n\r\n";
            byteArray   = Encoding.UTF8.GetBytes(requestLine);
            //byte[] byteArray = Encoding.ASCII.GetBytes(contents);
            stream = new MemoryStream(byteArray);
            WebServer.Reset();

            Assert.IsFalse(WebServer.IsVaid(stream));

            requestLine = "GET FDFDadf HTTP/1.1HeaderFejils\t:dfdf::jfjek:\r\n\r\n";
            byteArray   = Encoding.UTF8.GetBytes(requestLine);
            //byte[] byteArray = Encoding.ASCII.GetBytes(contents);
            stream = new MemoryStream(byteArray);
            WebServer.Reset();

            Assert.IsFalse(WebServer.IsVaid(stream));
        }