示例#1
0
 public Request(Server server, Host host, Connection connection)
     : base(String.Empty, String.Empty, null)
 {
     _connectionPermission = new PermissionSet(PermissionState.Unrestricted);
     _server = server;
     _host = host;
     _connection = connection;
 }
        public void GET_Request_Using_GetHost_And_TcpClient()
        {            
            var server = new Server("_temp_CassiniSite".tempDir());

            var socket = Server.CreateSocketBindAndListen(AddressFamily.InterNetwork, server.IPAddress, server.Port);            
            
            var thread = O2Thread.mtaThread(
                ()=>{
                        Socket acceptedSocket = socket.Accept();
                        var connection = new Connection(server,acceptedSocket);
                        //var host = new Host();                    // we can't get the host directly, it needs to be created using the technique coded in  
                        var host =server.GetHost();                 // CreateWorkerAppDomainWithHost 
                        
                        host.Configure(server, server.Port, server.VirtualPath, server.PhysicalPath);
                        host.ProcessRequest(connection);            
                    });
            
            var request1 = "GET / HTTP/1.1".line().line();
                
            var tcpClient1 = server.Port.tcpClient();
            tcpClient1.write(request1);            
            var response1 = tcpClient1.read_Response();
            Assert.IsTrue(response1.valid());                     

            server.PhysicalPath.delete_Folder();
        }
示例#3
0
 public override void EndOfRequest()
 {
     Connection conn = _connection;
     if (conn != null)
     {
         _connection = null;
         _server.OnRequestEnd(conn);
     }
 }
示例#4
0
        public void ProcessRequest(Connection conn)
        {
            // Add a pending call to make sure our thread doesn't get killed
            AddPendingCall();

            try
            {
                new Request(_server, this, conn).Process();
            }
            finally
            {
                RemovePendingCall();
            }
        }
示例#5
0
        public override void EndOfRequest()
        {
            Connection conn = _connection;
            if (conn != null)
            {
                _connection = null;
                _server.OnRequestEnd(conn, GetProcessUser());
            }

            if (_auth != null)
            {
                _auth.Dispose(); //
                _auth = null;
            }
        }