Inheritance: System.EventArgs
Example #1
0
 protected override void OnRequestReceived(RequestEventArgs <HttpRequest, HttpResponse> rea)
 {
     base.OnRequestReceived(rea);
     if (HttpRequestReceived != null)
     {
         HttpRequestReceived(this, (HttpServerEventArgs)rea);
     }
 }
Example #2
0
 protected override void Treat(RequestEventArgs <HttpRequest, HttpResponse> rea, Stream client)
 {
     try
     {
         base.Treat(rea, client);
         if (rea.Response.Headers.ContainsKey("Connection") && rea.Response.Headers["Connection"] == "Keep-Alive")
         {
             Treat(GetEventArgs(rea.Request), client);
         }
     }
     catch (NotImplementedException e)
     {
         ReplyError(client, e, HttpStatusCode.NotImplemented);
     }
     catch (Exception e)
     {
         ReplyError(client, e, HttpStatusCode.BadRequest);
     }
 }
Example #3
0
 private void ReceiveRequest(IAsyncResult result)
 {
     RequestEventArgs rea = new RequestEventArgs();
     IPEndPoint ep = new IPEndPoint(IPAddress.Any, Port);
     byte[] requestBytes = client.EndReceive(result, ref ep);
     if (IsStarted)
         client.BeginReceive(ReceiveRequest, null);
     HttpRequest request = HttpRequest.FromBytes(requestBytes);
     rea.Request = request;
     rea.Host = ep;
     try
     {
         OnRequestReceived(rea);
         Reply(ep, rea.Response);
     }
     catch (NotImplementedException e)
     {
         ReplyError(ep, e, HttpStatusCode.NotImplemented);
     }
     catch (Exception e)
     {
         ReplyError(ep, e, HttpStatusCode.BadRequest);
     }
 }
Example #4
0
 public abstract void Execute(RequestEventArgs e);
Example #5
0
 static void server_RequestReceived(object sender, RequestEventArgs<HttpRequest, HttpResponse> e)
 {
     Console.WriteLine("Request received from " + e.Host);
 }
Example #6
0
 public void OnRequestReceived(RequestEventArgs rea)
 {
     if (RequestReceived != null)
         RequestReceived(this, rea);
 }
Example #7
0
 public abstract void Execute(RequestEventArgs e);