Provides data for an event that occurred for a T:Stumps.IStumpsHttpContext.
Inheritance: System.EventArgs
示例#1
0
        /// <summary>
        /// Shows the response to an HTTP request on the screen.
        /// </summary>
        /// <param name="server">The <see cref="T:Stumps.StumpsServer"/> that processed the request.</param>
        /// <param name="e">The <see cref="StumpsContextEventArgs"/> instance containing the event data.</param>
        public static void ShowHttpResponse(StumpsServer server, StumpsContextEventArgs e)
        {
            var message = FriendlyOrigin[e.ResponseOrigin];

            if (e.ResponseOrigin == HttpResponseOrigin.Stump)
            {
                message += e.StumpId;
            }
            else if (e.ResponseOrigin == HttpResponseOrigin.RemoteServer)
            {
                message += server.RemoteHttpServer.DnsSafeHost;
            }

            Console.WriteLine("[{0}] => {1} {2}", message, e.Context.Request.HttpMethod, e.Context.Request.RawUrl);
        }
示例#2
0
 /// <summary>
 ///     Handles the RequestStarted event of the server instance.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:Stumps.StumpsContextEventArgs"/> instance containing the event data.</param>
 private void ServerRequestStarted(object sender, StumpsContextEventArgs e)
 {
     // Raise the request received event
     if (this.RequestReceived != null)
     {
         this.RequestReceived(this, e);
     }
 }
示例#3
0
 /// <summary>
 /// Handles the RequestProcessed event of the server instance.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="StumpsContextEventArgs"/> instance containing the event data.</param>
 private void ServerRequestProcessed(object sender, StumpsContextEventArgs e)
 {
     // Raise the request processed event
     if (this.RequestProcessed != null)
     {
         this.RequestProcessed(this, e);
     }
 }
示例#4
0
        /// <summary>
        /// Handles the requestFinishing event of the server instance.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:Stumps.StumpsContextEventArgs"/> instance containing the event data.</param>
        private void ServerRequestFinished(object sender, StumpsContextEventArgs e)
        {
            // Increment the request counter
            Interlocked.Increment(ref _requestCounter);

            if (e.ResponseOrigin == HttpResponseOrigin.RemoteServer)
            {
                // Increment the proxy counter
                Interlocked.Increment(ref _remoteHostCounter);
            }
            else if (e.ResponseOrigin == HttpResponseOrigin.Stump)
            {
                // Increment the Stumps counter
                Interlocked.Increment(ref _stumpsCounter);
            }

            // Raise the processed event
            if (this.RequestFinished != null)
            {
                this.RequestFinished(this, e);
            }
        }