/// <summary> /// A request was received from the parser. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnRequest(object sender, FactoryRequestEventArgs e) { _context = this; Response = HttpFactory.Current.Get <IResponse>(this, e.Request); _logger.Debug("Received '" + e.Request.Method + " " + e.Request.Uri.PathAndQuery + "' from " + Socket.RemoteEndPoint); LastAction = DateTime.Now; // keep alive. if (e.Request.Connection != null && e.Request.Connection.Type == ConnectionType.KeepAlive) { Response.Add(new StringHeader("Keep-Alive", "timeout=5, max=" + HTTPContextManager.MAX_KEEPALIVE)); } Request = e.Request; CurrentRequestReceived(this, new RequestEventArgs(this, e.Request, Response)); RequestReceived(this, new RequestEventArgs(this, e.Request, Response)); if (Response.Connection.Type == ConnectionType.KeepAlive) { HTTPContextManager.Register(this); } RequestCompleted(this, new RequestEventArgs(this, e.Request, Response)); CurrentRequestCompleted(this, new RequestEventArgs(this, e.Request, Response)); }