Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            int    port;
            string dir = Directory.GetCurrentDirectory();

            if (args.Length == 0 || !int.TryParse(args[0], out port))
            {
                port = 80;
            }

            InitHostFile(dir);
            SimpleHost host = (SimpleHost)ApplicationHost.CreateApplicationHost(typeof(SimpleHost), "/", dir);

            host.Config("/", dir);

            WebServer server = new WebServer(host, port);

            server.Start();
            OpenUrl("http://127.0.0.1/default.aspx");

            var key = Console.ReadKey();

            while (key.Key != ConsoleKey.Enter)
            {
                Thread.Sleep(1000);
            }
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public WorkerRequest(SimpleHost host, HttpProcessor processor, RequestInfo requestInfo)
        {
            _host        = host;
            _processor   = processor;
            _requestInfo = requestInfo;

            _responseHeaders   = new Dictionary <string, string>();
            _responseBodyBytes = new List <byte[]>();

            ParseRequestHeaders();
        }
Ejemplo n.º 3
0
        public WorkerRequest(SimpleHost host, HttpProcessor processor, RequestInfo requestInfo)
        {
            _host = host;
            _processor = processor;
            _requestInfo = requestInfo;

            _responseHeaders = new Dictionary<string, string>();
            _responseBodyBytes = new List<byte[]>();

            ParseRequestHeaders();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            int    port;
            string dir = Directory.GetCurrentDirectory();

            if (args.Length == 0 || !int.TryParse(args[0], out port))
            {
                port = 45758;
            }

            InitHostFile(dir);
            SimpleHost host = (SimpleHost)ApplicationHost.CreateApplicationHost(typeof(SimpleHost), "/", dir);

            host.Config("/", dir);

            WebServer server = new WebServer(host, port);

            server.Start();
        }
Ejemplo n.º 5
0
 public HttpProcessor(SimpleHost host, Socket socket)
 {
     _host = host;
     _socket = socket;
 }
Ejemplo n.º 6
0
 public WebServer(SimpleHost host, int port)
 {
     _host = host;
     Port  = port;
 }
Ejemplo n.º 7
0
 public WebServer(SimpleHost host, int port)
 {
     _host = host;
     Port = port;
 }
Ejemplo n.º 8
0
 public HttpProcessor(SimpleHost host, Socket socket)
 {
     _host   = host;
     _socket = socket;
 }