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);
        }
Пример #2
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);
                }
            }
        }