Exemple #1
0
        // Token: 0x06000FDD RID: 4061 RVA: 0x00062EB8 File Offset: 0x000610B8
        private void OnEndRequest(object sender, EventArgs e)
        {
            ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "OwaModule.OnEndRequest");
            HttpApplication httpApplication = (HttpApplication)sender;

            if (this.ShouldInterceptRequest(httpApplication.Context, false))
            {
                if (!Globals.IsInitialized)
                {
                    return;
                }
                HttpContext context    = httpApplication.Context;
                OwaContext  owaContext = OwaContext.Get(context);
                if (owaContext == null)
                {
                    return;
                }
                try
                {
                    this.requestInspector.OnEndRequest(owaContext);
                }
                finally
                {
                    if (Globals.FilterETag && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.FilterETag.Enabled)
                    {
                        context.Response.Headers.Remove("ETag");
                    }
                    long requestLatencyMilliseconds = owaContext.RequestLatencyMilliseconds;
                    if (Globals.OwaVDirType == OWAVDirType.OWA && Globals.ArePerfCountersEnabled)
                    {
                        if (RequestDispatcher.IsUserInitiatedRequest(context.Request))
                        {
                            PerformanceCounterManager.UpdateResponseTimePerformanceCounter(requestLatencyMilliseconds, OwaContext.Current.RequestExecution == RequestExecution.Proxy);
                        }
                        OwaSingleCounters.TotalRequests.Increment();
                        if (owaContext.ErrorInformation != null)
                        {
                            OwaSingleCounters.TotalRequestsFailed.Increment();
                            Exception exception = owaContext.ErrorInformation.Exception;
                            this.UpdateExceptionsPerfCountersQueues(exception);
                        }
                        else
                        {
                            this.UpdateExceptionsPerfCountersQueues(null);
                        }
                        if (owaContext.RequestExecution == RequestExecution.Proxy)
                        {
                            OwaSingleCounters.ProxiedUserRequests.Increment();
                        }
                    }
                    ExTraceGlobals.RequestTracer.TraceDebug <string, long>((long)owaContext.GetHashCode(), "Response: HTTP {0}, time:{1} ms.", owaContext.HttpContext.Response.Status, requestLatencyMilliseconds);
                    OwaDiagnostics.ClearThreadTracing();
                }
            }
        }
Exemple #2
0
        // Token: 0x06000FDA RID: 4058 RVA: 0x00062BB0 File Offset: 0x00060DB0
        private void OnAuthenticateRequest(object sender, EventArgs e)
        {
            ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "OwaModule.OnAuthenticateRequest");
            HttpApplication httpApplication = (HttpApplication)sender;

            if (this.ShouldInterceptRequest(httpApplication.Context, false))
            {
                HttpContext context = httpApplication.Context;
                if (UrlUtilities.IsWacRequest(httpApplication.Context.Request))
                {
                    context.User = new WindowsPrincipal(WindowsIdentity.GetAnonymous());
                    context.SkipAuthorization = true;
                }
                this.WriteOutlookSessionCookieIfNeeded(context);
                OwaContext owaContext = OwaContext.Create(context);
                OwaContext.Set(context, owaContext);
                bool flag = false;
                this.requestInspector.OnBeginRequest(sender, e, out flag);
                if (flag)
                {
                    return;
                }
                if (Globals.FilterETag && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.FilterETag.Enabled)
                {
                    context.Request.Headers.Remove("ETag");
                }
                ExTraceGlobals.RequestTracer.TraceDebug <string, string>((long)owaContext.GetHashCode(), "Request: {0} {1}", context.Request.HttpMethod, context.Request.Url.LocalPath);
                owaContext.TraceRequestId = Trace.TraceCasStart(CasTraceEventType.Owa);
                string arg;
                if (!Utilities.ValidateRequest(context, out arg))
                {
                    ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "Request is invalid, will not continue processing. Reason = {0}", arg);
                    Utilities.EndResponse(context, HttpStatusCode.BadRequest);
                }
                if (!Globals.IsInitialized)
                {
                    ExTraceGlobals.CoreTracer.TraceError(0L, "Can't process this request because the application wasn't succesfully initialized");
                    lock (this.firstFailedInitRequestLock)
                    {
                        if (this.firstFailedInitRequest != null)
                        {
                            if (ExDateTime.UtcNow.Subtract(this.firstFailedInitRequest.Value).TotalMilliseconds > 30000.0)
                            {
                                OwaDiagnostics.Logger.LogEvent(ClientsEventLogConstants.Tuple_OwaRestartingAfterFailedLoad, string.Empty, new object[0]);
                                AppDomain.Unload(Thread.GetDomain());
                            }
                        }
                        else
                        {
                            this.firstFailedInitRequest = new ExDateTime?(ExDateTime.UtcNow);
                        }
                    }
                    Utilities.RewritePathToError(owaContext, LocalizedStrings.GetNonEncoded(-1556449487), Globals.InitializationError.Message);
                    return;
                }
            }
            else if (this.IsBasicRequest(httpApplication.Context.Request))
            {
                Utilities.EndResponse(httpApplication.Context, HttpStatusCode.BadRequest);
            }
        }