// Token: 0x060019E7 RID: 6631 RVA: 0x000965F8 File Offset: 0x000947F8 private static void SetThreadCulture(OwaContext owaContext) { CultureInfo cultureInfo = Culture.GetBrowserDefaultCulture(owaContext); if (cultureInfo == null) { cultureInfo = Globals.ServerCulture; } owaContext.Culture = cultureInfo; Culture.SetThreadCulture(owaContext); }
public override void ProcessRequest(HttpContext context) { try { base.ProcessRequest(context); } catch (ThreadAbortException) { OwaContext.Get(context).UnlockMinResourcesOnCriticalError(); } }
internal static bool IsObsoleteRequest(OwaContext owaContext, UserContext userContext) { if (owaContext.RequestType == OwaRequestType.Oeh && userContext == null) { string queryStringParameter = Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "ns", false); string queryStringParameter2 = Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "ev", false); string queryStringParameter3 = Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "Fn", false); return(queryStringParameter == "PendingRequest" && queryStringParameter2 == "FinishNotificationRequest" && queryStringParameter3 == "1"); } return(false); }
// Token: 0x06000FDE RID: 4062 RVA: 0x0006301C File Offset: 0x0006121C private void OnError(object sender, EventArgs e) { ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "OwaModule.OnError"); HttpApplication httpApplication = (HttpApplication)sender; Exception lastError = httpApplication.Server.GetLastError(); if (this.ShouldInterceptRequest(httpApplication.Context, true)) { httpApplication.Server.ClearError(); Utilities.HandleException(OwaContext.Get(httpApplication.Context), lastError); } }
// Token: 0x060019E8 RID: 6632 RVA: 0x00096624 File Offset: 0x00094824 private static void LookupExperience(OwaContext owaContext) { BrowserType browserType; UserAgentParser.UserAgentVersion userAgentVersion; Experience[] array; RequestDispatcherUtilities.LookupExperiencesForRequest(owaContext, false, true, out browserType, out userAgentVersion, out array); if (array == null || array.Length == 0) { throw new OwaClientNotSupportedException("FormsRegistryManager.LookupExperiences couldn't find any experience for this client."); } owaContext.AnonymousSessionContext.Experiences = array; }
// Token: 0x06001372 RID: 4978 RVA: 0x00077FC4 File Offset: 0x000761C4 internal void WriteLog(OwaContext owaContext) { if (this.RefreshStart >= 0L) { SearchPerformanceData.WriteIndividualLog(owaContext, this.key + "s", this.RefreshStart); this.RefreshStart = -1L; } if (this.RefreshEnd >= 0L) { SearchPerformanceData.WriteIndividualLog(owaContext, this.key + "e", this.RefreshEnd); this.RefreshEnd = -1L; } }
private static SerializedSecurityContextType GetSecurityContext(OwaContext owaContext) { SecurityAccessToken securityAccessToken = new SecurityAccessToken(); owaContext.LogonIdentity.ClientSecurityContext.SetSecurityAccessToken(securityAccessToken); return(new SerializedSecurityContextType { UserSid = securityAccessToken.UserSid, RestrictedGroupSids = ProxyToEwsEventHandler.SidStringAndAttributesConverter(securityAccessToken.RestrictedGroupSids), GroupSids = ProxyToEwsEventHandler.SidStringAndAttributesConverter(securityAccessToken.GroupSids), PrimarySmtpAddress = owaContext.LogonIdentity.CreateExchangePrincipal().MailboxInfo.PrimarySmtpAddress.ToString() }); }
// Token: 0x0600126D RID: 4717 RVA: 0x000706F4 File Offset: 0x0006E8F4 internal static void EnsureProxyUrlSslPolicy(OwaContext owaContext, ProxyUri secondCasUri) { if (!OwaRegistryKeys.AllowProxyingWithoutSsl && secondCasUri.Uri.Scheme != Uri.UriSchemeHttps) { OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ProxyErrorSslConnection, secondCasUri.ToString(), new object[] { owaContext.LocalHostName, secondCasUri.ToString(), secondCasUri.ToString() }); throw new OwaProxyException(string.Format("The URI found for proxying does not start with \"https\". Value={0}", secondCasUri.ToString()), LocalizedStrings.GetNonEncoded(-750997814)); } }
// Token: 0x0600086B RID: 2155 RVA: 0x0003E71C File Offset: 0x0003C91C internal static void SetThreadCulture(OwaContext owaContext) { if (!Culture.IsThreadCultureSet(owaContext)) { if (owaContext.Culture != null) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "OwaContext.Culture was already set for this request but not for this thread (proxy scenario). Setting the Culture request \"{0}\" in the current thread.", owaContext.Culture.ToString()); Culture.InternalSetThreadCulture(owaContext.Culture, owaContext); return; } ExTraceGlobals.CoreTracer.TraceDebug(0L, "OwaContext.Culture was never set for this request. Setting the Culture request and culture thread to default culture."); Culture.InternalSetThreadCulture(Culture.GetDefaultCulture(owaContext), owaContext); } }
// Token: 0x060019E6 RID: 6630 RVA: 0x000963F0 File Offset: 0x000945F0 private static bool BindExchangePrincipal(OwaContext owaContext) { bool result = false; PublishingUrl publishingUrl = (PublishingUrl)owaContext.HttpContext.Items["AnonymousUserContextPublishedUrl"]; try { using (PublishedCalendar publishedCalendar = (PublishedCalendar)PublishedFolder.Create(publishingUrl)) { owaContext.ExchangePrincipal = publishedCalendar.CreateExchangePrincipal(); HttpContext.Current.Items["AnonymousUserContextExchangePrincipalKey"] = owaContext.ExchangePrincipal; HttpContext.Current.Items["AnonymousUserContextTimeZoneKey"] = publishedCalendar.TimeZone; HttpContext.Current.Items["AnonymousUserContextSharingDetailsKey"] = publishedCalendar.DetailLevel; HttpContext.Current.Items["AnonymousUserContextPublishedCalendarNameKey"] = publishedCalendar.DisplayName; HttpContext.Current.Items["AnonymousUserContextPublishedCalendarIdKey"] = publishedCalendar.FolderId; } } catch (WrongServerException ex) { ExTraceGlobals.CoreTracer.TraceDebug <WrongServerException>(0L, "CalendarVDirRequestDispatcher.BindExchangePrincipal: Returns 500 due to wrong BE server. Exception = {0}.", ex); owaContext.HttpContext.Response.AppendHeader("X-BEServerException", CalendarVDirRequestDispatcher.BEServerExceptionHeaderValue); string value = ex.RightServerToString(); if (!string.IsNullOrEmpty(value)) { owaContext.HttpContext.Response.AppendHeader(WellKnownHeader.XDBMountedOnServer, value); } owaContext.HttpContext.Response.TrySkipIisCustomErrors = true; Utilities.EndResponse(owaContext.HttpContext, HttpStatusCode.InternalServerError); result = true; } catch (PublishedFolderAccessDeniedException arg) { ExTraceGlobals.CoreTracer.TraceDebug <PublishedFolderAccessDeniedException>(0L, "CalendarVDirRequestDispatcher.BindExchangePrincipal: Returns 404 due to access is denied. Exception = {0}.", arg); Utilities.EndResponse(owaContext.HttpContext, HttpStatusCode.NotFound); result = true; } catch (FolderNotPublishedException arg2) { ExTraceGlobals.CoreTracer.TraceDebug <FolderNotPublishedException>(0L, "CalendarVDirRequestDispatcher.BindExchangePrincipal: Returns 404 due to Folder not published. Exception = {0}.", arg2); Utilities.EndResponse(owaContext.HttpContext, HttpStatusCode.NotFound); result = true; } catch (OverBudgetException ex2) { ExTraceGlobals.CoreTracer.TraceDebug <OverBudgetException>(0L, "CalendarVDirRequestDispatcher.BindExchangePrincipal: User is throttled. Exception = {0}.", ex2); Utilities.HandleException(owaContext, ex2); result = true; } return(result); }
// Token: 0x060019A5 RID: 6565 RVA: 0x00095B38 File Offset: 0x00093D38 public AnonymousSessionContext(OwaContext owaContext) { this.owaContext = owaContext; this.PublishingUrl = (PublishingUrl)owaContext.HttpContext.Items["AnonymousUserContextPublishedUrl"]; HttpCookie httpCookie = owaContext.HttpContext.Request.Cookies["timezone"]; ExTimeZone exTimeZone; if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value) && ExTimeZoneEnumerator.Instance.TryGetTimeZoneByName(httpCookie.Value, out exTimeZone)) { this.timeZone = exTimeZone; this.IsTimeZoneFromCookie = true; return; } this.timeZone = ExTimeZone.CurrentTimeZone; }
// Token: 0x0600126B RID: 4715 RVA: 0x00070594 File Offset: 0x0006E794 internal static void ThrowMalformedCasUriException(OwaContext owaContext, string malformedUri) { string text = owaContext.ExchangePrincipal.LegacyDn; if (text == null) { text = string.Empty; } OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ProxyErrorWrongUriFormat, malformedUri, new object[] { owaContext.LocalHostName, text, malformedUri }); throw new OwaProxyException(string.Format("The format of the uri is wrong: {0}", malformedUri), string.Format(Strings.ErrorWrongUriFormat, malformedUri)); }
// Token: 0x06001988 RID: 6536 RVA: 0x000953D4 File Offset: 0x000935D4 internal Stream GetItemAttachmentStream(Attachment attachment, HttpContext httpContext) { OwaContext owaContext = OwaContext.Get(httpContext); UserContext userContext = owaContext.UserContext; OutboundConversionOptions outboundConversionOptions = Utilities.CreateOutboundConversionOptions(userContext); Stream stream = Streams.CreateTemporaryStorageStream(); string text = null; ItemAttachment itemAttachment = attachment as ItemAttachment; using (Item item = itemAttachment.GetItem(StoreObjectSchema.ContentConversionProperties)) { try { if (ItemConversion.IsItemClassConvertibleToMime(item.ClassName)) { ItemConversion.ConvertItemToMime(item, stream, outboundConversionOptions); text = ".eml"; } else if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(item.ClassName)) { (item as CalendarItemBase).ExportAsICAL(stream, "UTF-8", outboundConversionOptions); text = ".ics"; } else if (ObjectClass.IsContact(item.ClassName)) { Contact.ExportVCard(item as Contact, stream, outboundConversionOptions); text = ".vcf"; } else { ItemConversion.ConvertItemToMsgStorage(item, stream, outboundConversionOptions); } } catch (Exception) { stream = this.GetContentsReplacementStream(-1706159495); text = ".txt"; } } if (text != null) { this.fileName = this.GetConvertedItemFileName(this.fileName, text); this.encodedfileNameBytes = this.GetEncodedString(this.fileName); } stream.Position = 0L; return(stream); }
// Token: 0x06001261 RID: 4705 RVA: 0x0006FF40 File Offset: 0x0006E140 internal static HttpWebRequest CreateHttpWebRequestForProxying(OwaContext owaContext, Uri requestUri) { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUri); httpWebRequest.UnsafeAuthenticatedConnectionSharing = true; httpWebRequest.PreAuthenticate = true; httpWebRequest.AllowAutoRedirect = false; httpWebRequest.Credentials = CredentialCache.DefaultNetworkCredentials.GetCredential(requestUri, "Kerberos"); if (httpWebRequest.Credentials == null) { throw new OwaInvalidOperationException("Can't get credentials for the proxy request"); } httpWebRequest.AutomaticDecompression = DecompressionMethods.GZip; CertificateValidationManager.SetComponentId(httpWebRequest, requestUri.IsLoopback ? "OWA_IgnoreCertErrors" : "OWA"); GccUtils.CopyClientIPEndpointsForServerToServerProxy(owaContext.HttpContext, httpWebRequest); return(httpWebRequest); }
// Token: 0x0600120B RID: 4619 RVA: 0x0006D974 File Offset: 0x0006BB74 internal void BeginSend(OwaContext owaContext, HttpRequest originalRequest, string targetUrl, string proxyRequestBody, AsyncCallback callback, object extraData) { ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyProtocolRequest.BeginSend"); Uri uri = new UriBuilder(owaContext.SecondCasUri.Uri) { Path = targetUrl }.Uri; HttpWebRequest proxyRequestInstance = ProxyUtilities.GetProxyRequestInstance(originalRequest, owaContext, uri); proxyRequestInstance.ContentLength = (long)((proxyRequestBody != null) ? Encoding.UTF8.GetByteCount(proxyRequestBody) : 0); proxyRequestInstance.Method = "POST"; this.proxyRequest = proxyRequestInstance; this.proxyRequestBody = proxyRequestBody; this.owaContext = owaContext; this.asyncResult = new OwaAsyncResult(callback, extraData); proxyRequestInstance.BeginGetRequestStream(new AsyncCallback(this.GetRequestStreamCallback), this); }
internal void BeginSend(OwaContext owaContext, AsyncCallback callback, object extraData) { ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyPingRequest.BeginSend"); Uri uri = new UriBuilder(owaContext.SecondCasUri.Uri) { Path = OwaUrl.ProxyPing.GetExplicitUrl(owaContext) }.Uri; HttpWebRequest httpWebRequest = ProxyUtilities.CreateHttpWebRequestForProxying(owaContext, uri); httpWebRequest.Method = "GET"; httpWebRequest.UserAgent = "OwaProxy"; this.request = httpWebRequest; this.asyncResult = new OwaAsyncResult(callback, extraData); this.requestTimedOut = false; IAsyncResult asyncResult = ProxyUtilities.BeginGetResponse(this.request, new AsyncCallback(this.GetResponseCallback), this, out this.requestClock); this.timeoutWaitHandle = ThreadPool.RegisterWaitForSingleObject(asyncResult.AsyncWaitHandle, new WaitOrTimerCallback(this.RequestTimeoutCallback), asyncResult, (long)owaContext.HttpContext.Server.ScriptTimeout * 1000L, true); }
internal static void TracePerformance(UserContext userContext) { OwaContext owaContext = OwaContext.Current; if (ETWTrace.ShouldTraceCasStop(owaContext.TraceRequestId)) { string userContext2 = string.Empty; HttpRequest request = owaContext.HttpContext.Request; int totalBytes = request.TotalBytes; string pathAndQuery = request.Url.PathAndQuery; ExchangePrincipal exchangePrincipal = userContext.ExchangePrincipal; if (exchangePrincipal != null) { userContext2 = exchangePrincipal.MailboxInfo.DisplayName; } Trace.TraceCasStop(CasTraceEventType.Owa, owaContext.TraceRequestId, totalBytes, 0, owaContext.LocalHostName, userContext2, "OwaModule", pathAndQuery, string.Empty); } }
// Token: 0x0600136C RID: 4972 RVA: 0x00077EE8 File Offset: 0x000760E8 internal void WriteLog(OwaContext owaContext) { if (this.Latency >= 0L) { SearchPerformanceData.WriteIndividualLog(owaContext, this.key, this.Latency); this.Latency = -1L; } if (this.ItemCount >= 0) { SearchPerformanceData.WriteIndividualLog(owaContext, this.key + "ic", this.ItemCount); this.ItemCount = -1; } if (this.PendingGetPickup >= 0L) { SearchPerformanceData.WriteIndividualLog(owaContext, this.key + "pg", this.PendingGetPickup); this.PendingGetPickup = -1L; } }
// Token: 0x06001914 RID: 6420 RVA: 0x00091A08 File Offset: 0x0008FC08 public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action) { if (owaContext == null) { throw new ArgumentNullException("owaContext"); } this.userContext = owaContext.UserContext; this.owaContext = owaContext; applicationElement = ApplicationElement.Folder; type = "IPF.Note"; action = null; state = null; PreFormActionResponse preFormActionResponse = null; using (Folder folder = this.ProcessWebPartRequest()) { if (folder != null) { preFormActionResponse = new PreFormActionResponse(); preFormActionResponse.AddParameter("id", OwaStoreObjectId.CreateFromStoreObject(folder).ToBase64String()); if (!string.IsNullOrEmpty(this.webPartParameters["view"])) { preFormActionResponse.AddParameter("view", this.webPartParameters["view"]); } if (this.isoDateString != null) { preFormActionResponse.AddParameter("d", this.isoDateString); } type = folder.ClassName; int num = 0; if (int.TryParse(this.webPartParameters["part"], out num) && num == 1) { applicationElement = ApplicationElement.WebPartFolder; } preFormActionResponse.ApplicationElement = applicationElement; preFormActionResponse.Action = action; preFormActionResponse.Type = type; preFormActionResponse.State = state; } } return(preFormActionResponse); }
// Token: 0x060019E3 RID: 6627 RVA: 0x000960B4 File Offset: 0x000942B4 private static bool CheckRequestType(OwaContext owaContext) { bool result = false; owaContext.RequestType = Utilities.GetRequestType(owaContext.HttpContext.Request); if (owaContext.RequestType == OwaRequestType.Resource) { return(true); } if (owaContext.RequestType != OwaRequestType.PublishedCalendarView && owaContext.RequestType != OwaRequestType.ProxyPing && owaContext.RequestType != OwaRequestType.ServiceRequest && owaContext.RequestType != OwaRequestType.ICalHttpHandler) { Utilities.EndResponse(owaContext.HttpContext, HttpStatusCode.BadRequest); result = true; } if (owaContext.RequestType == OwaRequestType.ProxyPing) { RequestDispatcherUtilities.RespondProxyPing(owaContext); Utilities.EndResponse(owaContext.HttpContext, owaContext.HttpStatusCode); } return(result); }
// Token: 0x0600086E RID: 2158 RVA: 0x0003E804 File Offset: 0x0003CA04 public static CultureInfo GetBrowserDefaultCulture(OwaContext owaContext) { string[] userLanguages = owaContext.HttpContext.Request.UserLanguages; if (userLanguages != null) { int num = Math.Min(5, userLanguages.Length); for (int i = 0; i < num; i++) { string text = Culture.ValidateLanguageTag(userLanguages[i]); if (text != null) { CultureInfo supportedBrowserLanguage = Culture.GetSupportedBrowserLanguage(text); if (supportedBrowserLanguage != null) { return(supportedBrowserLanguage); } } } } return(null); }
// Token: 0x06000717 RID: 1815 RVA: 0x0003786C File Offset: 0x00035A6C private static int SendDocumentContentToHttpStream(HttpContext httpContext, Stream stream, string fileName, string fileExtension, string contentType, bool isInline, Charset charset, BlockStatus blockStatus, AttachmentPolicy.Level level, bool doNeedToFilterHtml) { if (AttachmentUtility.IsMhtmlAttachment(contentType, fileExtension)) { ExTraceGlobals.AttachmentHandlingTracer.TraceDebug <string>(0L, "AttachmentHandler.SendDocumentContentToHttpStream: Explicitly blocking MHTML attachment {0}", fileName); return(0); } AttachmentHandler.SetAttachmentResponseHeaders(httpContext, fileName, contentType, isInline, level); uint result; if (doNeedToFilterHtml) { result = AttachmentUtility.WriteFilteredResponse(httpContext, stream, charset, blockStatus); } else { bool isNotHtmlandNotXml = !AttachmentUtility.GetIsHtmlOrXml(contentType, fileExtension); bool doNotSniff = AttachmentUtility.GetDoNotSniff(level, OwaContext.Get(httpContext).UserContext); result = AttachmentUtility.WriteUnfilteredResponse(httpContext, stream, fileName, isNotHtmlandNotXml, doNotSniff); } return((int)result); }
// Token: 0x0600085C RID: 2140 RVA: 0x0003E370 File Offset: 0x0003C570 public static void UpdateUserCulture(UserContext userContext, CultureInfo culture, bool updateAD) { if (culture == null) { throw new ArgumentNullException("culture"); } if (userContext == null) { throw new OwaInvalidOperationException("Shouldn't call UpdateUserCulture without a session"); } if (updateAD) { PreferredCultures preferredCultures = new PreferredCultures(userContext.ExchangePrincipal.PreferredCultures); preferredCultures.AddSupportedCulture(culture, new Predicate <CultureInfo>(Culture.IsSupportedCulture)); Culture.SetPreferredCulture(userContext.ExchangePrincipal, preferredCultures, userContext.MailboxSession.GetADRecipientSession(false, ConsistencyMode.FullyConsistent)); userContext.ExchangePrincipal = userContext.ExchangePrincipal.WithPreferredCultures(preferredCultures); } userContext.UserCulture = culture; Culture.InternalSetThreadCulture(culture); userContext.RecreateMailboxSession(OwaContext.Get(HttpContext.Current)); userContext.RecreatePublicFolderSessions(); }
// Token: 0x06001334 RID: 4916 RVA: 0x000772B0 File Offset: 0x000754B0 internal static void SetProxyRequestUrl(OwaContext owaContext) { UriBuilder uriBuilder = new UriBuilder(owaContext.HttpContext.Request.Url); Uri uri = uriBuilder.Uri; uriBuilder = new UriBuilder(owaContext.SecondCasUri.Uri); uriBuilder.Path = uri.AbsolutePath; string text = uri.Query; if (text.StartsWith("?", StringComparison.Ordinal)) { text = text.Substring(1, text.Length - 1); } uriBuilder.Query = text; Uri uri2 = uriBuilder.Uri; OwaDiagnostics.TracePfd(23177, "The request will be proxied to \"{0}\"", new object[] { uri2 }); owaContext.SetInternalHandlerParameter("pru", uri2); }
// Token: 0x06001657 RID: 5719 RVA: 0x000836D4 File Offset: 0x000818D4 internal static UserContextCookie GetUserContextCookie(OwaContext owaContext) { HttpRequest request = owaContext.HttpContext.Request; for (int i = 0; i < request.Cookies.Count; i++) { HttpCookie httpCookie = request.Cookies[i]; if (httpCookie.Name != null && httpCookie.Name.StartsWith("UserContext", StringComparison.OrdinalIgnoreCase)) { UserContextCookie userContextCookie = UserContextCookie.TryCreateFromHttpCookie(httpCookie, owaContext.LogonIdentity.UniqueId); if (userContextCookie == null) { ExTraceGlobals.UserContextTracer.TraceDebug(24L, "Invalid user context cookie received. Cookie value={0}, logonIdentity={1}, owaContext.MailboxIdentity.UniqueId={2}, owaContext.IsDifferentMailbox={3}", new object[] { httpCookie.Value, owaContext.LogonIdentity.UniqueId, owaContext.MailboxIdentity.UniqueId, owaContext.IsDifferentMailbox }); throw new OwaInvalidRequestException("Invalid user context cookie received. Cookie value:" + httpCookie.Value + " logonIdentity:" + owaContext.LogonIdentity.UniqueId); } if (userContextCookie.MailboxUniqueKey == null) { if (!owaContext.IsDifferentMailbox) { return(userContextCookie); } } else if (string.Equals(userContextCookie.MailboxUniqueKey, owaContext.MailboxIdentity.UniqueId, StringComparison.Ordinal)) { return(userContextCookie); } ExTraceGlobals.UserContextTracer.TraceDebug <string, string, bool>(24L, "currentCookie.MailboxUniqueKey={0}, owaContext.MailboxIdentity.UniqueId={1}, owaContext.IsDifferentMailbox={2}", userContextCookie.MailboxUniqueKey, owaContext.MailboxIdentity.UniqueId, owaContext.IsDifferentMailbox); } } return(null); }
internal void BeginSend(OwaContext owaContext, HttpRequest originalRequest, OwaIdentity identity, CultureInfo culture, string timeZoneKeyName, bool isOptimized, string destination, AsyncCallback callback, object extraData) { ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyLanguagePostRequest.BeginSend"); StringWriter stringWriter = null; XmlTextWriter xmlTextWriter = null; string proxyRequestBody = null; try { stringWriter = new StringWriter(); xmlTextWriter = new XmlTextWriter(stringWriter); xmlTextWriter.WriteStartElement(ProxyLanguagePostRequest.rootElementName); xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.localeIdAttributeName, culture.LCID.ToString()); xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.timeZoneKeyNameAttributeName, timeZoneKeyName); xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.isOptimizedAttributeName, isOptimized ? "1" : "0"); xmlTextWriter.WriteAttributeString(ProxyLanguagePostRequest.destinationAttributeName, destination); SerializedClientSecurityContext serializedClientSecurityContext = SerializedClientSecurityContext.CreateFromOwaIdentity(identity); serializedClientSecurityContext.Serialize(xmlTextWriter); xmlTextWriter.WriteEndElement(); stringWriter.Flush(); proxyRequestBody = stringWriter.ToString(); ExTraceGlobals.ProxyDataTracer.TraceDebug <int, string, bool>((long)this.GetHashCode(), "Sending xml payload with lcid={0}, tzid={1}, isOptimized={2}", culture.LCID, timeZoneKeyName, isOptimized); } finally { if (stringWriter != null) { stringWriter.Close(); } if (xmlTextWriter != null) { xmlTextWriter.Close(); } } base.BeginSend(owaContext, originalRequest, OwaUrl.LanguagePost.GetExplicitUrl(originalRequest), proxyRequestBody, callback, extraData); }
// Token: 0x06001362 RID: 4962 RVA: 0x00077CAC File Offset: 0x00075EAC internal void WriteLog() { OwaContext owaContext = OwaContext.Current; if (owaContext == null) { throw new InvalidOperationException("OwaContext.Current is null. SearchPerformanceData.WriteLog should be called in the context of a request."); } SearchPerformanceData.WriteIndividualLog(owaContext, "srchid", this.searchId); if (Globals.CollectSearchStrings && this.searchString != null) { SearchPerformanceData.WriteIndividualLog(owaContext, "srchstr", this.searchString); this.searchString = null; } if (this.refreshLatency != null) { this.refreshLatency.WriteLog(owaContext); } if (this.firstPageLatency != null) { this.firstPageLatency.WriteLog(owaContext); } if (this.completeLatency != null) { this.completeLatency.WriteLog(owaContext); } if (this.completeLatency.Latency >= 0L) { if (this.isTimeout) { SearchPerformanceData.WriteIndividualLog(owaContext, "srchto", 1); this.isTimeout = false; } if (this.isSync) { SearchPerformanceData.WriteIndividualLog(owaContext, "srchsync", 1); this.isSync = false; } } if (this.searchFailed) { SearchPerformanceData.WriteIndividualLog(owaContext, "srchfl", "1"); } if (this.slowSearchEnabled) { SearchPerformanceData.WriteIndividualLog(owaContext, "srchslowenabled", "1"); } if (this.writeSearchFolderData) { SearchState searchState = SearchState.None; int num = -1; bool flag = false; bool searchFolderData = SearchPerformanceData.GetSearchFolderData(owaContext.UserContext, out num, out searchState, out flag); if (searchFolderData) { SearchPerformanceData.WriteIndividualLog(owaContext, "srchsess", flag); } if (searchState != SearchState.None) { SearchPerformanceData.WriteIndividualLog(owaContext, "srchstate", string.Format(NumberFormatInfo.InvariantInfo, "0x{0:X8}", new object[] { (int)searchState })); } if (num != -1) { SearchPerformanceData.WriteIndividualLog(owaContext, "srchcount", num); } this.writeSearchFolderData = false; } }
// Token: 0x06000E48 RID: 3656 RVA: 0x0005BA1D File Offset: 0x00059C1D internal static bool ShouldIgnoreRequest(OwaContext owaContext, UserContext userContext) { return(PendingRequestEventHandler.IsObsoleteRequest(owaContext, userContext)); }
internal override void OnEndRequest(OwaContext owaContext) { try { } finally { UserContext userContext = owaContext.UserContext; bool flag = false; try { if (owaContext.UserContext != null && !owaContext.UserContext.LockedByCurrentThread()) { if (!owaContext.IsAsyncRequest && !owaContext.HandledCriticalError && !owaContext.UserContext.LastLockRequestFailed) { ExWatson.SendReport(new InvalidOperationException("Entered OwaRequestEventInspector without the UserContext lock when we should have had it."), ReportOptions.None, null); } owaContext.UserContext.Lock(); } try { try { if (userContext != null && userContext.State == UserContextState.Active) { userContext.CleanupOnEndRequest(); owaContext.ExitLatencyDetectionContext(); OwaPerformanceLogger.LogPerformanceStatistics(userContext); OwaPerformanceLogger.TracePerformance(userContext); this.AppendServerHeaders(owaContext); if (owaContext.SearchPerformanceData != null) { owaContext.SearchPerformanceData.RefreshEnd(); owaContext.SearchPerformanceData.WriteLog(); } } } finally { owaContext.DisposeObjectsOnEndRequest(); } } catch (OwaLockTimeoutException) { flag = true; } finally { if (userContext != null && !flag) { if (owaContext.IgnoreUnlockForcefully) { userContext.Unlock(); } else { userContext.UnlockForcefully(); } } } } finally { owaContext.TryReleaseBudgetAndStopTiming(); if (owaContext.PreFormActionData != null && owaContext.PreFormActionData is IDisposable) { ((IDisposable)owaContext.PreFormActionData).Dispose(); owaContext.PreFormActionData = null; } } } }
internal static void LogPerformanceStatistics(UserContext userContext) { OwaContext owaContext = OwaContext.Current; if (userContext.IsClientSideDataCollectingEnabled) { string str = "&v="; owaContext.HttpContext.Response.AppendToLog(str + Globals.ApplicationVersion); } StringBuilder stringBuilder = new StringBuilder(OwaPerformanceLogger.EstimatedIISStringBuilderCapacity); long requestLatencyMilliseconds = owaContext.RequestLatencyMilliseconds; if (userContext.HasValidMailboxSession()) { ExchangePrincipal exchangePrincipal = userContext.ExchangePrincipal; if (exchangePrincipal != null) { string serverFqdn = exchangePrincipal.MailboxInfo.Location.ServerFqdn; if (serverFqdn != null) { stringBuilder.Append("&mbx=").Append(serverFqdn); } } } stringBuilder.Append("&sessionId=").Append(userContext.Key.UserContextId); stringBuilder.Append("&prfltncy=").Append(requestLatencyMilliseconds); uint num = 0U; long num2 = 0L; uint num3 = 0U; long num4 = 0L; if (owaContext.RequestExecution == RequestExecution.Local) { TaskPerformanceData rpcData = owaContext.RpcData; if (rpcData != null && rpcData.End != PerformanceData.Zero) { PerformanceData difference = rpcData.Difference; num = difference.Count; num2 = (long)difference.Milliseconds; PerformanceData ewsRpcData = owaContext.EwsRpcData; if (ewsRpcData != PerformanceData.Zero) { num += ewsRpcData.Count; num2 += (long)ewsRpcData.Milliseconds; } OwaPerformanceLogger.rpcLogger.AppendIISLogsEntry(stringBuilder, num, num2); } TaskPerformanceData ldapData = owaContext.LdapData; if (ldapData != null) { PerformanceData difference2 = ldapData.Difference; num3 = difference2.Count; num4 = (long)difference2.Milliseconds; PerformanceData ewsLdapData = owaContext.EwsLdapData; if (ewsLdapData != PerformanceData.Zero) { num3 += ewsLdapData.Count; num4 += (long)ewsLdapData.Milliseconds; } OwaPerformanceLogger.ldapLogger.AppendIISLogsEntry(stringBuilder, num3, num4); } OwaPerformanceLogger.AppendLatencyHeaders(num2, num4, requestLatencyMilliseconds); OwaPerformanceLogger.availabilityLogger.AppendIISLogsEntry(stringBuilder, owaContext.AvailabilityQueryCount, owaContext.AvailabilityQueryLatency); } owaContext.HttpContext.Response.AppendToLog(stringBuilder.ToString()); if (Globals.CollectPerRequestPerformanceStats) { StringBuilder stringBuilder2 = new StringBuilder(OwaPerformanceLogger.EstimatedBreadcrumbStringBuilderCapacity); stringBuilder2.Append("Total: ").Append(requestLatencyMilliseconds).Append(" ms"); owaContext.OwaPerformanceData.TotalLatency = requestLatencyMilliseconds; owaContext.OwaPerformanceData.KilobytesAllocated = (long)((ulong)owaContext.MemoryData.Difference.Count); if (owaContext.HasTrustworthyRequestCpuLatency) { stringBuilder2.Append(" CPU: "); stringBuilder2.Append(owaContext.RequestCpuLatencyMilliseconds).Append(" ms"); } if (owaContext.RequestExecution == RequestExecution.Local) { owaContext.OwaPerformanceData.RpcCount = num; owaContext.OwaPerformanceData.RpcLatency = (int)num2; owaContext.OwaPerformanceData.LdapCount = num3; owaContext.OwaPerformanceData.LdapLatency = (int)num4; OwaPerformanceLogger.rpcLogger.AppendBreadcrumbEntry(stringBuilder2, num, num2); OwaPerformanceLogger.ldapLogger.AppendBreadcrumbEntry(stringBuilder2, num3, num4); OwaPerformanceLogger.availabilityLogger.AppendBreadcrumbEntry(stringBuilder2, owaContext.AvailabilityQueryCount, owaContext.AvailabilityQueryLatency); if (!string.IsNullOrEmpty(owaContext.EwsPerformanceHeader)) { owaContext.OwaPerformanceData.TraceOther(owaContext.EwsPerformanceHeader); } } owaContext.UserContext.PerformanceConsoleNotifier.UpdatePerformanceData(owaContext.OwaPerformanceData, true); userContext.LogBreadcrumb(stringBuilder2.ToString()); } }