Example #1
0
        private static void AddClientLoadTimeDataPoint(Dictionary <string, string> rawKeyValuePairs, Dictionary <string, string> calculatedKeyValuePairs, string contextId, string ipAddress, string clientVersion, bool isMowa, string userName, UserContext userContext, string clientIdCookieValue = null)
        {
            List <string> list  = new List <string>();
            List <string> list2 = new List <string>();

            foreach (string text in rawKeyValuePairs.Keys)
            {
                if (!Plt1WebHandler.ShouldIgnoreKey(text))
                {
                    list.Add(text);
                    list2.Add(rawKeyValuePairs[text]);
                }
            }
            foreach (string text2 in calculatedKeyValuePairs.Keys)
            {
                if (!Plt1WebHandler.ShouldIgnoreKey(text2))
                {
                    list.Add(text2);
                    list2.Add(calculatedKeyValuePairs[text2]);
                }
            }
            Datapoint      datapoint = new Datapoint(DatapointConsumer.Analytics, "ClientLoadTime", DateTime.UtcNow.ToString("o"), list.ToArray(), list2.ToArray());
            ClientLogEvent logEvent  = new ClientLogEvent(datapoint, contextId, ipAddress, userName, clientVersion, Globals.ApplicationVersion ?? string.Empty, isMowa, clientIdCookieValue);

            Plt1WebHandler.UpdateLogEventCommonData(logEvent, userContext);
            OwaClientLogger.AppendToLog(logEvent);
        }
Example #2
0
        private static void AddCalculatedClientLoadTimeDataPoint(Dictionary <string, string> rawKeyValuePairs, Dictionary <string, string> calculatedKeyValuePairs, string contextId, string ipAddress, string clientVersion, bool isMowa, string userName, string clientIdCookieValue = null)
        {
            List <string> list  = new List <string>();
            List <string> list2 = new List <string>();

            if (rawKeyValuePairs.ContainsKey("brn"))
            {
                list.Add("brn");
                list2.Add(rawKeyValuePairs["brn"]);
            }
            if (rawKeyValuePairs.ContainsKey("brv"))
            {
                list.Add("brv");
                list2.Add(rawKeyValuePairs["brv"]);
            }
            if (rawKeyValuePairs.ContainsKey("tg"))
            {
                list.Add("tg");
                list2.Add(rawKeyValuePairs["tg"]);
            }
            if (rawKeyValuePairs.ContainsKey("domL"))
            {
                list.Add("domL");
                list2.Add(rawKeyValuePairs["domL"]);
            }
            if (rawKeyValuePairs.ContainsKey("pE"))
            {
                list.Add("DPT");
                list2.Add(rawKeyValuePairs["pE"]);
            }
            if (rawKeyValuePairs.ContainsKey("rpo"))
            {
                list.Add("RPO");
                list2.Add(rawKeyValuePairs["rpo"]);
            }
            if (rawKeyValuePairs.ContainsKey("te"))
            {
                list.Add("te");
                list2.Add(rawKeyValuePairs["te"]);
            }
            foreach (string text in calculatedKeyValuePairs.Keys)
            {
                if (!Plt1WebHandler.ShouldIgnoreKey(text))
                {
                    list.Add(text);
                    list2.Add(calculatedKeyValuePairs[text]);
                }
            }
            Datapoint      datapoint = new Datapoint(DatapointConsumer.Analytics, "CalculatedClientLoadTime", DateTime.UtcNow.ToString("o"), list.ToArray(), list2.ToArray());
            ClientLogEvent logEvent  = new ClientLogEvent(datapoint, contextId, ipAddress, userName, clientVersion, Globals.ApplicationVersion ?? string.Empty, isMowa, clientIdCookieValue);

            OwaClientLogger.AppendToLog(logEvent);
        }
Example #3
0
        public void ProcessRequest(HttpContext context)
        {
            string      userContextId           = Plt1WebHandler.GetUserContextId(context);
            bool        isMowa                  = OfflineClientRequestUtilities.IsRequestFromMOWAClient(context.Request, context.Request.UserAgent);
            HttpRequest request                 = context.Request;
            string      clientAddressWithoutPII = this.GetClientAddressWithoutPII(request);
            UserAgent   userAgent               = OwaUserAgentUtilities.CreateUserAgentWithLayoutOverride(context);
            string      userName                = string.Empty;
            string      cookieValueAndSetIfNull = ClientIdCookie.GetCookieValueAndSetIfNull(context);
            UserContext userContext             = UserContextManager.GetUserContext(context, false);

            if (userContext != null && userContext.LogonIdentity != null)
            {
                SmtpAddress primarySmtpAddress = userContext.LogonIdentity.PrimarySmtpAddress;
                userName = userContext.LogonIdentity.PrimarySmtpAddress.ToString();
            }
            if (Plt1WebHandler.IsPlt1PerformanceRequest(request))
            {
                string text = "";
                if (context.Request.HttpMethod == "POST")
                {
                    using (StreamReader streamReader = new StreamReader(context.Request.InputStream))
                    {
                        text = streamReader.ReadToEnd();
                        context.Response.AppendToLog(text);
                    }
                }
                string clientVersion = context.Request.QueryString.Get("cver") ?? string.Empty;
                Uri    uri;
                string refererQueryString = request.TryParseUrlReferrer(out uri) ? uri.Query : "noRefUrl";
                Dictionary <string, string> dictionary  = new Dictionary <string, string>();
                Dictionary <string, string> dictionary2 = new Dictionary <string, string>();
                Plt1WebHandler.GetPlt1PerformanceEventData(userAgent, refererQueryString, request.QueryString, text, dictionary, dictionary2);
                Plt1WebHandler.AddClientLoadTimeDataPoint(dictionary, dictionary2, userContextId, clientAddressWithoutPII, clientVersion, isMowa, userName, userContext, cookieValueAndSetIfNull);
                if (dictionary2.Count > 0 && dictionary.ContainsKey("msg") && dictionary["msg"].Contains("success"))
                {
                    Plt1WebHandler.AddCalculatedClientLoadTimeDataPoint(dictionary, dictionary2, userContextId, clientAddressWithoutPII, clientVersion, isMowa, userName, cookieValueAndSetIfNull);
                }
                if (userContext != null && userContext.FeaturesManager != null && userContext.FeaturesManager.ServerSettings.OwaServerLogonActivityLogging.Enabled)
                {
                    this.AddtoActivityLog(userContext, dictionary, userName, clientAddressWithoutPII, userAgent.RawString);
                }
            }
            else
            {
                string         clientVersion2  = context.Request.QueryString.Get("v") ?? string.Empty;
                ClientLogEvent plt1AccessEvent = Plt1WebHandler.GetPlt1AccessEvent(userContextId, request.UserAgent, clientAddressWithoutPII, clientVersion2, isMowa, cookieValueAndSetIfNull);
                OwaClientLogger.AppendToLog(plt1AccessEvent);
            }
            Plt1WebHandler.SetResponseHeaders(context.Response);
            Plt1WebHandler.WriteImage(context.Response);
        }
        // Token: 0x06001158 RID: 4440 RVA: 0x000426A0 File Offset: 0x000408A0
        internal override void Initialize()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            ExTraceGlobals.ConfigurationManagerTracer.TraceDebug(0L, "OwaApplication.Initialize: SafeHtml loading begin");
            IntPtr value = NativeMethods.LoadLibrary(Path.GetFullPath(Path.Combine(ExchangeSetupContext.BinPath, "SafeHtmlNativeWrapper.dll")));

            if (value == IntPtr.Zero)
            {
                ExTraceGlobals.ConfigurationManagerTracer.TraceError(0L, "OwaApplication.Initialize: Failed to load SafeHtmlNativeWrapper.");
                Global.SafeHtmlLoaded = false;
            }
            else
            {
                ExTraceGlobals.ConfigurationManagerTracer.TraceDebug(0L, "OwaApplication.Initialize: SafeHtmlNativeWrapper loaded successfully.");
                Global.SafeHtmlLoaded = true;
            }
            SafeHtml.Initialize(ExchangeSetupContext.BinPath + Path.DirectorySeparatorChar);
            ExTraceGlobals.ConfigurationManagerTracer.TraceDebug(0L, "OwaApplication.Initialize: SafeHtml loading finished");
            Global.InitializeSettingsFromWebConfig();
            int workerThreads;
            int num;

            ThreadPool.GetMinThreads(out workerThreads, out num);
            int configIntValue = AppConfigLoader.GetConfigIntValue("ThreadPoolMinIOCPThreads", 0, int.MaxValue, 3 * Environment.ProcessorCount);

            ThreadPool.SetMinThreads(workerThreads, configIntValue);
            OwaApplication.InitializeApplicationCaches();
            RequestDetailsLogger.ApplicationType = LoggerApplicationType.Owa;
            OwaClientLogger.Initialize();
            OwaClientTraceLogger.Initialize();
            OwaServerLogger.Initialize();
            OwaServerTraceLogger.Initialize();
            SettingOverrideSync.Instance.Start(true);
            LoggerSettings.MaxAppendableColumnLength   = null;
            LoggerSettings.ErrorMessageLengthThreshold = null;
            Global.ResponseShapeResolver = new OwaResponseShapeResolver();
            Global.EwsClientMailboxSessionCloningHandler = new EwsClientMailboxSessionCloningHandler(UserContextManager.GetClonedMailboxSession);
            Global.DefaultMapiClientType             = "Client=OWA";
            MailboxSession.DefaultFoldersToForceInit = OwaApplication.foldersToForceInitialize;
            UserContextManager.Initialize();
            if (Globals.OwaIsNoRecycleEnabled)
            {
                OwaVersionId.InitializeOwaVersionReadingTimer();
            }
            KillBitTimer.Singleton.Start();
            KillbitWatcher.TryWatch(new KillbitWatcher.ReadKillBitFromFileCallback(KillBitHelper.ReadKillBitFromFile));
            OwaServerLogger.AppendToLog(new OwaAppStartLogEvent((double)stopwatch.ElapsedMilliseconds));
        }