示例#1
0
 internal void OnPreSendRequestHeaders(HttpContextBase context)
 {
     if (!this.isEnabled)
     {
         return;
     }
     Diagnostics.SendWatsonReportOnUnhandledException(delegate()
     {
         if (NativeProxyHelper.CanNativeProxyHandleRequest(context.ApplicationInstance.Context) && context.Response.StatusCode == 200)
         {
             this.AddCookiesToClientResponse(context);
         }
     }, new Diagnostics.LastChanceExceptionHandler(this.LastChanceExceptionHandler));
 }
示例#2
0
 internal void OnPostAuthorizeRequest(HttpContextBase context)
 {
     if (!this.isEnabled)
     {
         return;
     }
     Diagnostics.SendWatsonReportOnUnhandledException(delegate()
     {
         if (NativeProxyHelper.CanNativeProxyHandleRequest(context.ApplicationInstance.Context))
         {
             NativeProxyHelper.UpdateRequestHeaders(context.ApplicationInstance.Context);
         }
     }, new Diagnostics.LastChanceExceptionHandler(this.LastChanceExceptionHandler));
 }
示例#3
0
        protected virtual void OnPostAuthorizeInternal(HttpApplication httpApplication)
        {
            HttpContext context = httpApplication.Context;

            if (NativeProxyHelper.CanNativeProxyHandleRequest(context))
            {
                RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(context), "ProxyRequestHandler", "NativeHttpProxy");

                return;
            }
            IHttpHandler httpHandler;

            if (context.Request.IsAuthenticated)
            {
                httpHandler = this.SelectHandlerForAuthenticatedRequest(context);
            }
            else
            {
                httpHandler = this.SelectHandlerForUnauthenticatedRequest(context);
            }
            if (httpHandler != null)
            {
                if (Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.IsTraceEnabled(TraceType.DebugTrace))
                {
                    Microsoft.Exchange.Diagnostics.Components.HttpProxy.ExTraceGlobals.VerboseTracer.TraceDebug <Type, object>((long)this.GetHashCode(), "[ProxyModule::OnPostAuthorizeInternal]: The selected HttpHandler is {0}; Context {1};", httpHandler.GetType(), context.Items[Constants.TraceContextKey]);
                }
                PerfCounters.HttpProxyCountersInstance.TotalRequests.Increment();
                if (httpHandler is ProxyRequestHandler)
                {
                    ((ProxyRequestHandler)httpHandler).Run(context);
                }
                else
                {
                    context.RemapHandler(httpHandler);
                }
                long currentLatency = LatencyTracker.FromHttpContext(context).GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);
                if (currentLatency > 100L)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(context), "RemapHandler", currentLatency);
                }
            }
        }