예제 #1
0
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            string beresouceCookie = BEResourceRequestHandler.GetBEResouceCookie(base.ClientRequest);

            if (!string.IsNullOrEmpty(beresouceCookie))
            {
                base.Logger.Set(HttpProxyMetadata.RoutingHint, Constants.BEResource + "-Cookie");
                ExTraceGlobals.VerboseTracer.TraceDebug <string, int>((long)this.GetHashCode(), "[BEResourceRequestHanlder::ResolveAnchorMailbox]: BEResource cookie used: {0}; context {1}.", beresouceCookie, base.TraceContext);
                return(new ServerInfoAnchorMailbox(BackEndServer.FromString(beresouceCookie), this));
            }
            return(base.ResolveAnchorMailbox());
        }
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            if (E4eProxyRequestHandler.IsErrorPageRequest(base.ClientRequest))
            {
                return(new AnonymousAnchorMailbox(this));
            }
            if (E4eProxyRequestHandler.IsE4eInvalidStoreRequest(base.ClientRequest))
            {
                this.ThrowRedirectException(E4eProxyRequestHandler.GetErrorUrl(E4eProxyRequestHandler.E4eErrorType.InvalidStoreRequest));
            }
            bool flag = E4eProxyRequestHandler.IsE4ePostPayloadRequest(base.ClientRequest);

            this.GetSenderInfo(flag);
            string text = this.senderEmailAddress;

            if (!string.IsNullOrEmpty(text) && SmtpAddress.IsValidSmtpAddress(text))
            {
                string recipientEmailAddress = base.ClientRequest.QueryString["RecipientEmailAddress"];
                if (flag)
                {
                    if (E4eBackoffListCache.Instance.ShouldBackOff(text, recipientEmailAddress))
                    {
                        PerfCounters.HttpProxyCountersInstance.RejectedConnectionCount.Increment();
                        this.ThrowRedirectException(E4eProxyRequestHandler.GetErrorUrl(E4eProxyRequestHandler.E4eErrorType.ThrottlingRestriction));
                    }
                    else
                    {
                        PerfCounters.HttpProxyCountersInstance.AcceptedConnectionCount.Increment();
                    }
                }
                return(new SmtpWithDomainFallbackAnchorMailbox(text, this)
                {
                    UseServerCookie = true
                });
            }
            if (BEResourceRequestHandler.IsResourceRequest(base.ClientRequest.Url.LocalPath))
            {
                return(new AnonymousAnchorMailbox(this));
            }
            string text2 = string.Format("The sender's email address is not valid. Email={0}, SMTP={1}", this.senderEmailAddress, text);

            base.Logger.AppendGenericError("Invalid sender email address", text2);
            throw new HttpProxyException(HttpStatusCode.NotFound, HttpProxySubErrorCode.EndpointNotFound, text2);
        }
예제 #3
0
        // Token: 0x060004DB RID: 1243 RVA: 0x0001ABB0 File Offset: 0x00018DB0
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            if (E4eProxyRequestHandler.IsAnonymousErrorPageRequest(base.ClientRequest) || E4eProxyRequestHandler.IsAnonymousAppRedirectPageRequest(base.ClientRequest) || E4eProxyRequestHandler.IsAnonymousAppFeedbackRequest(base.ClientRequest))
            {
                return(new AnonymousAnchorMailbox(this));
            }
            if (E4eProxyRequestHandler.IsE4eInvalidStoreRequest(base.ClientRequest))
            {
                this.ThrowRedirectException(E4eProxyRequestHandler.GetErrorUrl(E4eProxyRequestHandler.E4eErrorType.InvalidStoreRequest));
            }
            bool flag  = E4eProxyRequestHandler.IsE4ePostOrRetrievePayloadRequest(base.ClientRequest);
            bool flag2 = this.IsWACRequest();

            this.GetSenderInfo(flag, flag2);
            string text = this.routingEmailAddress;

            if (E4eProxyRequestHandler.IsRESTAPIUploadRequset(base.ClientRequest) && string.IsNullOrEmpty(text))
            {
                return(new AnonymousAnchorMailbox(this));
            }
            if (string.IsNullOrEmpty(text) || !SmtpAddress.IsValidSmtpAddress(text))
            {
                if (BEResourceRequestHandler.IsResourceRequest(base.ClientRequest.Url.LocalPath))
                {
                    return(new AnonymousAnchorMailbox(this));
                }
                string text2 = string.Format("The routing email address is not valid. Email={0}", text);
                base.Logger.AppendGenericError("Invalid routing email address", text2);
                throw new HttpProxyException(HttpStatusCode.NotFound, 3001, text2);
            }
            else
            {
                if (flag)
                {
                    string recipientEmailAddress = base.ClientRequest.QueryString["RecipientEmailAddress"];
                    if (E4eBackoffListCache.Instance.ShouldBackOff(this.senderEmailAddress, recipientEmailAddress))
                    {
                        PerfCounters.HttpProxyCountersInstance.RejectedConnectionCount.Increment();
                        this.ThrowRedirectException(E4eProxyRequestHandler.GetErrorUrl(E4eProxyRequestHandler.E4eErrorType.ThrottlingRestriction));
                    }
                    else
                    {
                        PerfCounters.HttpProxyCountersInstance.AcceptedConnectionCount.Increment();
                    }
                }
                if (!this.IsBackEndCookieAndHeaderFlightEnabled())
                {
                    return(this.GetAnchorMailbox());
                }
                if (flag)
                {
                    string text3 = base.ClientRequest.Headers["X-E4ePostToBackEnd"];
                    if (!string.IsNullOrEmpty(text3))
                    {
                        return(new ServerInfoAnchorMailbox(text3, this));
                    }
                    return(this.GetAnchorMailbox());
                }
                else if (flag2)
                {
                    string text4;
                    string text5;
                    if (!this.GetRoutingInformationForWac(out text4, out text5))
                    {
                        base.Logger.AppendGenericError("E4EWacRequest", "Invalid routing information for request coming from WAC server, url:" + base.ClientRequest.Url);
                        return(this.GetAnchorMailbox());
                    }
                    AnchorMailbox result = new ServerInfoAnchorMailbox(text4, this);
                    base.Logger.AppendGenericInfo("E4eBEServerCookieHint", string.Format("Using BE server cookie hint. Cookie value [{0}]", text4));
                    return(result);
                }
                else
                {
                    if (!E4eProxyRequestHandler.IsRequestBoundToBEServer(base.ClientRequest))
                    {
                        return(this.GetAnchorMailbox());
                    }
                    string backendFqdnFromE4eCookie = E4eProxyRequestHandler.GetBackendFqdnFromE4eCookie(base.ClientRequest, base.Logger);
                    if (string.IsNullOrEmpty(backendFqdnFromE4eCookie))
                    {
                        return(this.GetAnchorMailbox());
                    }
                    AnchorMailbox result2 = new ServerInfoAnchorMailbox(backendFqdnFromE4eCookie, this);
                    base.Logger.AppendGenericInfo("E4eBEServerCookieHint", string.Format("Using BE server cookie hint. Cookie value [{0}]", backendFqdnFromE4eCookie));
                    return(result2);
                }
            }
        }
예제 #4
0
 // Token: 0x060004E7 RID: 1255 RVA: 0x0001B22D File Offset: 0x0001942D
 private static bool IsRequestBoundToBEServer(HttpRequest request)
 {
     return(!E4eProxyRequestHandler.IsErrorPageRequest(request) && !BEResourceRequestHandler.IsResourceRequest(request.Url.LocalPath));
 }
 // Token: 0x060004CE RID: 1230 RVA: 0x0001AA5A File Offset: 0x00018C5A
 internal static bool CanHandle(HttpRequest httpRequest)
 {
     return(!string.IsNullOrEmpty(BEResourceRequestHandler.GetBEResouceCookie(httpRequest)) && BEResourceRequestHandler.IsResourceRequest(httpRequest.Url.LocalPath));
 }
예제 #6
0
        private IHttpHandler SelectHandlerForUnauthenticatedRequest(HttpContext httpContext)
        {
            IHttpHandler result;

            try
            {
                IHttpHandler httpHandler = null;
                if (HttpProxyGlobals.ProtocolType == ProtocolType.Autodiscover)
                {
                    if (httpContext.Request.HttpMethod.Equals("GET", StringComparison.OrdinalIgnoreCase))
                    {
                        if (ProtocolHelper.IsOAuthMetadataRequest(httpContext.Request.Url.AbsolutePath))
                        {
                            httpHandler = new AuthMetadataHttpHandler(httpContext);
                        }
                        else if (ProtocolHelper.IsAutodiscoverV2Request(httpContext.Request.Url.AbsolutePath))
                        {
                            httpHandler = new AutodiscoverProxyRequestHandler();
                        }
                    }
                    else
                    {
                        httpHandler = new AutodiscoverProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Ews)
                {
                    string httpMethod = httpContext.Request.HttpMethod;
                    if (!httpMethod.Equals("GET", StringComparison.OrdinalIgnoreCase) && !httpMethod.Equals("HEAD", StringComparison.OrdinalIgnoreCase))
                    {
                        httpHandler = new EwsProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Ecp)
                {
                    if (EDiscoveryExportToolProxyRequestHandler.IsEDiscoveryExportToolProxyRequest(httpContext.Request))
                    {
                        httpHandler = new EDiscoveryExportToolProxyRequestHandler();
                    }
                    else if (BEResourceRequestHandler.CanHandle(httpContext.Request))
                    {
                        httpHandler = new BEResourceRequestHandler();
                    }
                    else if (EcpProxyRequestHandler.IsCrossForestDelegatedRequest(httpContext.Request))
                    {
                        httpHandler = new EcpProxyRequestHandler
                        {
                            IsCrossForestDelegated = true
                        };
                    }
                    else if (!httpContext.Request.Path.StartsWith("/ecp/auth/", StringComparison.OrdinalIgnoreCase) && !httpContext.Request.Path.Equals("/ecp/ping.ecp", StringComparison.OrdinalIgnoreCase))
                    {
                        httpHandler = new Return401RequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.RpcHttp)
                {
                    httpHandler = new RpcHttpRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Xrop)
                {
                    httpHandler = new XRopProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.E4e)
                {
                    httpHandler = new E4eProxyRequestHandler();
                }
                else if (AnonymousCalendarProxyRequestHandler.IsAnonymousCalendarRequest(httpContext.Request))
                {
                    httpHandler = new AnonymousCalendarProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Owa && WopiRequestPathHandler.IsWopiRequest(httpContext.Request, AuthCommon.IsFrontEnd))
                {
                    httpHandler = new WopiProxyRequestHandler();
                }
                else if (OwaExtensibilityProxyRequestHandler.IsOwaExtensibilityRequest(httpContext.Request))
                {
                    httpHandler = new OwaExtensibilityProxyRequestHandler();
                }
                else if (OwaCobrandingRedirProxyRequestHandler.IsCobrandingRedirRequest(httpContext.Request))
                {
                    httpHandler = new OwaCobrandingRedirProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Owa && OwaResourceProxyRequestHandler.CanHandle(httpContext.Request))
                {
                    httpHandler = new OwaResourceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.PowerShellGateway)
                {
                    httpHandler = new PsgwProxyRequestHandler();
                }
                result = httpHandler;
            }
            finally
            {
                long currentLatency = LatencyTracker.FromHttpContext(httpContext).GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);
                if (currentLatency > 100L)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext), "SelectHandler", currentLatency);
                }
            }
            return(result);
        }
예제 #7
0
        private IHttpHandler SelectHandlerForAuthenticatedRequest(HttpContext httpContext)
        {
            IHttpHandler result;

            try
            {
                IHttpHandler httpHandler;
                if (HttpProxyGlobals.ProtocolType == ProtocolType.Mapi)
                {
                    httpHandler = new MapiProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Ecp)
                {
                    if (SiteMailboxCreatingProxyRequestHandler.IsSiteMailboxCreatingProxyRequest(httpContext.Request))
                    {
                        httpHandler = new SiteMailboxCreatingProxyRequestHandler();
                    }
                    else if (EDiscoveryExportToolProxyRequestHandler.IsEDiscoveryExportToolProxyRequest(httpContext.Request))
                    {
                        httpHandler = new EDiscoveryExportToolProxyRequestHandler();
                    }
                    else if (BEResourceRequestHandler.CanHandle(httpContext.Request))
                    {
                        httpHandler = new BEResourceRequestHandler();
                    }
                    else
                    {
                        httpHandler = new EcpProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Autodiscover)
                {
                    httpHandler = new AutodiscoverProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Ews)
                {
                    if (EwsUserPhotoProxyRequestHandler.IsUserPhotoRequest(httpContext.Request))
                    {
                        httpHandler = new EwsUserPhotoProxyRequestHandler();
                    }
                    else if (EwsODataProxyRequestHandler.IsODataRequest(httpContext.Request))
                    {
                        httpHandler = new EwsODataProxyRequestHandler();
                    }
                    else if (MrsProxyRequestHandler.IsMrsRequest(httpContext.Request))
                    {
                        httpHandler = new MrsProxyRequestHandler();
                    }
                    else if (MessageTrackingRequestHandler.IsMessageTrackingRequest(httpContext.Request))
                    {
                        httpHandler = new MessageTrackingRequestHandler();
                    }
                    else
                    {
                        httpHandler = new EwsProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.RpcHttp)
                {
                    if (RpcHttpRequestHandler.CanHandleRequest(httpContext.Request))
                    {
                        httpHandler = new RpcHttpRequestHandler();
                    }
                    else
                    {
                        httpHandler = new RpcHttpProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Eas)
                {
                    httpHandler = new EasProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Oab)
                {
                    httpHandler = new OabProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.PowerShell || HttpProxyGlobals.ProtocolType == ProtocolType.PowerShellLiveId)
                {
                    httpHandler = new RemotePowerShellProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.ReportingWebService)
                {
                    httpHandler = new ReportingWebServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Psws)
                {
                    httpHandler = new PswsProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Xrop)
                {
                    httpHandler = new XRopProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.Owa)
                {
                    string absolutePath = httpContext.Request.Url.AbsolutePath;
                    if (OWAUserPhotoProxyRequestHandler.IsUserPhotoRequest(httpContext.Request))
                    {
                        httpHandler = new OWAUserPhotoProxyRequestHandler();
                    }
                    else if (absolutePath.EndsWith("service.svc", StringComparison.OrdinalIgnoreCase) || absolutePath.IndexOf("/service.svc/", StringComparison.OrdinalIgnoreCase) != -1)
                    {
                        httpHandler = new EwsJsonProxyRequestHandler();
                    }
                    else if (absolutePath.EndsWith("ev.owa2", StringComparison.OrdinalIgnoreCase))
                    {
                        httpHandler = new OwaOeh2ProxyRequestHandler();
                    }
                    else if (absolutePath.EndsWith("speech.reco", StringComparison.OrdinalIgnoreCase))
                    {
                        httpHandler = new SpeechRecoProxyRequestHandler();
                    }
                    else if (absolutePath.EndsWith("lang.owa", StringComparison.OrdinalIgnoreCase))
                    {
                        httpHandler = new OwaLanguagePostProxyRequestHandler();
                    }
                    else if (absolutePath.EndsWith("ev.owa", StringComparison.OrdinalIgnoreCase) && httpContext.Request.RawUrl.IndexOf("ns=EwsProxy", StringComparison.OrdinalIgnoreCase) > 0)
                    {
                        httpHandler = new EwsProxyRequestHandler(true);
                    }
                    else
                    {
                        httpHandler = new OwaProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.PushNotifications)
                {
                    httpHandler = new PushNotificationsProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.OutlookService)
                {
                    httpHandler = new OutlookServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.SnackyService)
                {
                    httpHandler = new SnackyServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == ProtocolType.E4e)
                {
                    httpHandler = new E4eProxyRequestHandler();
                }
                else
                {
                    if (HttpProxyGlobals.ProtocolType != ProtocolType.O365SuiteService)
                    {
                        throw new InvalidOperationException("Unknown protocol type " + HttpProxyGlobals.ProtocolType);
                    }
                    httpHandler = new O365SuiteServiceProxyRequestHandler();
                }
                result = httpHandler;
            }
            finally
            {
                long currentLatency = LatencyTracker.FromHttpContext(httpContext).GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);
                if (currentLatency > 100L)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext), "SelectHandler", currentLatency);
                }
            }
            return(result);
        }
 // Token: 0x0600059A RID: 1434 RVA: 0x0001F224 File Offset: 0x0001D424
 protected bool IsResourceRequest()
 {
     return(BEResourceRequestHandler.IsResourceRequest(base.ClientRequest.Url.LocalPath));
 }
        protected bool IsResourceRequest()
        {
            string localPath = base.ClientRequest.Url.LocalPath;

            return(BEResourceRequestHandler.IsResourceRequest(localPath));
        }
        internal static bool CanHandle(HttpRequest httpRequest)
        {
            HttpCookie httpCookie = httpRequest.Cookies[Constants.AnonResource];

            return(httpCookie != null && string.Compare(httpCookie.Value, "true", CultureInfo.InvariantCulture, CompareOptions.IgnoreCase) == 0 && BEResourceRequestHandler.IsResourceRequest(httpRequest.Url.LocalPath));
        }
예제 #11
0
        // Token: 0x060005F5 RID: 1525 RVA: 0x00021738 File Offset: 0x0001F938
        private IHttpHandler SelectHandlerForUnauthenticatedRequest(HttpContext httpContext)
        {
            IHttpHandler result;

            try
            {
                if (HttpProxySettings.NeedHandleAsAuthenticatedRequest(httpContext.Request.Headers, httpContext.Request.Cookies, httpContext.SkipAuthorization))
                {
                    result = this.SelectHandlerForAuthenticatedRequest(httpContext);
                }
                else
                {
                    UriBuilder uriBuilder = new UriBuilder(httpContext.Request.Url);
                    string     text       = null;
                    if (UrlUtilities.TryGetExplicitLogonUser(httpContext.Request, ref text))
                    {
                        uriBuilder.Path = UrlUtilities.GetPathWithExplictLogonHint(httpContext.Request.Url, text);
                    }
                    IHttpHandler httpHandler = null;
                    if (HttpProxyGlobals.ProtocolType == 9)
                    {
                        httpHandler = new AutodiscoverProxyRequestHandler();
                    }
                    else if (HttpProxyGlobals.ProtocolType == 2)
                    {
                        if (RequestPathParser.IsEwsUnauthenticatedRequestProxyHandlerAllowed(httpContext.Request))
                        {
                            httpHandler = new EwsProxyRequestHandler();
                        }
                    }
                    else if (HttpProxyGlobals.ProtocolType == 27)
                    {
                        if (RequestPathParser.IsRestUnauthenticatedRequestProxyHandlerAllowed(httpContext.Request))
                        {
                            httpHandler = new RestProxyRequestHandler();
                        }
                    }
                    else if (HttpProxyGlobals.ProtocolType == 1)
                    {
                        if (EDiscoveryExportToolProxyRequestHandler.IsEDiscoveryExportToolProxyRequest(httpContext.Request))
                        {
                            httpHandler = new EDiscoveryExportToolProxyRequestHandler();
                        }
                        else if (BEResourceRequestHandler.CanHandle(httpContext.Request))
                        {
                            httpHandler = new BEResourceRequestHandler();
                        }
                        else if (EcpProxyRequestHandler.IsCrossForestDelegatedRequest(httpContext.Request))
                        {
                            httpHandler = new EcpProxyRequestHandler
                            {
                                IsCrossForestDelegated = true
                            };
                        }
                        else if (!httpContext.Request.Path.StartsWith("/ecp/auth/", StringComparison.OrdinalIgnoreCase) && !httpContext.Request.Path.Equals("/ecp/ping.ecp", StringComparison.OrdinalIgnoreCase))
                        {
                            httpHandler = new Return401RequestHandler();
                        }
                    }
                    else if (HttpProxyGlobals.ProtocolType == 8)
                    {
                        httpHandler = new RpcHttpRequestHandler();
                    }
                    else if (HttpProxyGlobals.ProtocolType == 12)
                    {
                        httpHandler = new XRopProxyRequestHandler();
                    }
                    else if (HttpProxyGlobals.ProtocolType == 15)
                    {
                        httpHandler = new E4eProxyRequestHandler();
                    }
                    else if (AnonymousCalendarProxyRequestHandler.IsAnonymousCalendarRequest(httpContext.Request))
                    {
                        httpHandler = new AnonymousCalendarProxyRequestHandler();
                    }
                    else if (HttpProxyGlobals.ProtocolType == 4 && WopiRequestPathHandler.IsWopiRequest(httpContext.Request.HttpMethod, httpContext.Request.Url, AuthCommon.IsFrontEnd))
                    {
                        httpHandler = new WopiProxyRequestHandler();
                    }
                    else if (OwaExtensibilityProxyRequestHandler.IsOwaExtensibilityRequest(httpContext.Request))
                    {
                        httpHandler = new OwaExtensibilityProxyRequestHandler();
                    }
                    else if (UrlUtilities.IsOwaDownloadRequest(uriBuilder.Uri))
                    {
                        httpHandler = new OwaDownloadProxyRequestHandler();
                    }
                    else if (OwaCobrandingRedirProxyRequestHandler.IsCobrandingRedirRequest(httpContext.Request))
                    {
                        httpHandler = new OwaCobrandingRedirProxyRequestHandler();
                    }
                    else if (HttpProxyGlobals.ProtocolType == 4 && OwaResourceProxyRequestHandler.CanHandle(httpContext.Request))
                    {
                        httpHandler = new OwaResourceProxyRequestHandler();
                    }
                    else if (HttpProxyGlobals.ProtocolType == 19)
                    {
                        httpHandler = new PsgwProxyRequestHandler();
                    }
                    else if (HttpProxyGlobals.ProtocolType == 21)
                    {
                        httpHandler = new MailboxDeliveryProxyRequestHandler();
                    }
                    else if (HttpProxyGlobals.ProtocolType == 22)
                    {
                        httpHandler = new ComplianceServiceProxyRequestHandler();
                    }
                    result = httpHandler;
                }
            }
            finally
            {
                long currentLatency = LatencyTracker.FromHttpContext(httpContext).GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);
                if (currentLatency > 100L)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext), "SelectHandler", currentLatency);
                }
            }
            return(result);
        }
예제 #12
0
        // Token: 0x060005F4 RID: 1524 RVA: 0x000213C0 File Offset: 0x0001F5C0
        private IHttpHandler SelectHandlerForAuthenticatedRequest(HttpContext httpContext)
        {
            IHttpHandler result;

            try
            {
                IHttpHandler httpHandler;
                if (HttpProxyGlobals.ProtocolType == 14)
                {
                    httpHandler = new MapiProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 1)
                {
                    if (SiteMailboxCreatingProxyRequestHandler.IsSiteMailboxCreatingProxyRequest(httpContext.Request))
                    {
                        httpHandler = new SiteMailboxCreatingProxyRequestHandler();
                    }
                    else if (EDiscoveryExportToolProxyRequestHandler.IsEDiscoveryExportToolProxyRequest(httpContext.Request))
                    {
                        httpHandler = new EDiscoveryExportToolProxyRequestHandler();
                    }
                    else if (BEResourceRequestHandler.CanHandle(httpContext.Request))
                    {
                        httpHandler = new BEResourceRequestHandler();
                    }
                    else
                    {
                        httpHandler = new EcpProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == 9)
                {
                    httpHandler = new AutodiscoverProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 2)
                {
                    if (EwsUserPhotoProxyRequestHandler.IsUserPhotoRequest(httpContext.Request))
                    {
                        httpHandler = new EwsUserPhotoProxyRequestHandler();
                    }
                    else if (MrsProxyRequestHandler.IsMrsRequest(httpContext.Request))
                    {
                        httpHandler = new MrsProxyRequestHandler();
                    }
                    else if (MessageTrackingRequestHandler.IsMessageTrackingRequest(httpContext.Request))
                    {
                        httpHandler = new MessageTrackingRequestHandler();
                    }
                    else
                    {
                        httpHandler = new EwsProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == 27)
                {
                    httpHandler = new RestProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 8)
                {
                    if (RpcHttpRequestHandler.CanHandleRequest(httpContext.Request))
                    {
                        httpHandler = new RpcHttpRequestHandler();
                    }
                    else
                    {
                        httpHandler = new RpcHttpProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == null)
                {
                    httpHandler = new EasProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 3)
                {
                    httpHandler = new OabProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 6 || HttpProxyGlobals.ProtocolType == 7)
                {
                    httpHandler = new RemotePowerShellProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 10)
                {
                    httpHandler = new ReportingWebServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 11)
                {
                    httpHandler = new PswsProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 12)
                {
                    httpHandler = new XRopProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 4)
                {
                    string absolutePath = httpContext.Request.Url.AbsolutePath;
                    if (OWAUserPhotoProxyRequestHandler.IsUserPhotoRequest(httpContext.Request))
                    {
                        httpHandler = new OWAUserPhotoProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaEwsJsonRequest(absolutePath))
                    {
                        httpHandler = new EwsJsonProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaOeh2Request(absolutePath))
                    {
                        httpHandler = new OwaOeh2ProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaSpeechRecoRequest(absolutePath))
                    {
                        httpHandler = new SpeechRecoProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaLanguagePostRequest(absolutePath))
                    {
                        httpHandler = new OwaLanguagePostProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaE14ProxyRequest(absolutePath, httpContext.Request.RawUrl))
                    {
                        httpHandler = new EwsProxyRequestHandler(true);
                    }
                    else if (AuthenticatedWopiRequestPathHandler.IsAuthenticatedWopiRequest(httpContext.Request, AuthCommon.IsFrontEnd))
                    {
                        httpHandler = new AuthenticatedWopiProxyRequestHandler();
                    }
                    else
                    {
                        httpHandler = new OwaProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == 13)
                {
                    httpHandler = new PushNotificationsProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 16)
                {
                    httpHandler = new OutlookServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 17)
                {
                    httpHandler = new SnackyServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 18)
                {
                    httpHandler = new MicroServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 15)
                {
                    httpHandler = new E4eProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 20)
                {
                    httpHandler = new O365SuiteServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 21)
                {
                    httpHandler = new MailboxDeliveryProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 22)
                {
                    httpHandler = new ComplianceServiceProxyRequestHandler();
                }
                else
                {
                    if (HttpProxyGlobals.ProtocolType != 24)
                    {
                        throw new InvalidOperationException("Unknown protocol type " + HttpProxyGlobals.ProtocolType);
                    }
                    httpHandler = new LogExportProxyHandler();
                }
                result = httpHandler;
            }
            finally
            {
                long currentLatency = LatencyTracker.FromHttpContext(httpContext).GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);
                if (currentLatency > 100L)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext), "SelectHandler", currentLatency);
                }
            }
            return(result);
        }