Пример #1
0
        /// <summary>
        /// Process a HTTP request (callback for HttpListener)
        /// </summary>
        /// <param name="ar">Something from HttpListener</param>
        private void ProcessRequest(IAsyncResult ar)
        {
            Load++;
            UpdateStatistics();
            LogWriter Logger    = new LogWriter();
            DateTime  BeginTime = Logger.BeginTime;

#if DEBUG
            Logger.WriteLine("Got a request.");
#endif
            HttpListenerContext ctx = _listener.EndGetContext(ar);
            _listener.BeginGetContext(ProcessRequest, null);
            HttpListenerRequest req = ctx.Request;

            Logger.WriteLine(">{0} {1} ({2})", req.HttpMethod, req.RawUrl, req.RemoteEndPoint.Address);

            HttpListenerResponse resp = ctx.Response;
            Transit Tranzit           = new Transit(req, resp, Logger);

            Logger.WriteLine("<Done.");
            Load--;
            UpdateStatistics();
        }