Ejemplo n.º 1
0
 // Token: 0x060004ED RID: 1261 RVA: 0x0001B554 File Offset: 0x00019754
 private void UpdateBackoffCache()
 {
     if (E4eProxyRequestHandler.IsE4ePostOrRetrievePayloadRequest(base.ClientRequest))
     {
         string serverResponseCookieValue  = this.GetServerResponseCookieValue("X-E4eBudgetType");
         string serverResponseCookieValue2 = this.GetServerResponseCookieValue("X-E4eEmailAddress");
         string serverResponseCookieValue3 = this.GetServerResponseCookieValue("X-E4eBackOffUntilUtc");
         E4eBackoffListCache.Instance.UpdateCache(serverResponseCookieValue, serverResponseCookieValue2, serverResponseCookieValue3);
     }
 }
Ejemplo n.º 2
0
 // Token: 0x060004DE RID: 1246 RVA: 0x0001AE80 File Offset: 0x00019080
 protected override void CopySupplementalCookiesToClientResponse()
 {
     this.UpdateBackoffCache();
     if (!string.IsNullOrEmpty(this.senderEmailAddress))
     {
         HttpCookie httpCookie = new HttpCookie("X-SenderEmailAddress", this.senderEmailAddress);
         httpCookie.HttpOnly = true;
         httpCookie.Secure   = base.ClientRequest.IsSecureConnection;
         base.ClientResponse.Cookies.Add(httpCookie);
     }
     if (!string.IsNullOrEmpty(this.senderOrganization))
     {
         HttpCookie httpCookie2 = new HttpCookie("X-SenderOrganization", this.senderOrganization);
         httpCookie2.HttpOnly = true;
         httpCookie2.Secure   = base.ClientRequest.IsSecureConnection;
         base.ClientResponse.Cookies.Add(httpCookie2);
     }
     if (!string.IsNullOrWhiteSpace(this.routingEmailAddress))
     {
         HttpCookie httpCookie3 = new HttpCookie("X-RoutingEmailAddress", this.routingEmailAddress);
         httpCookie3.HttpOnly = true;
         httpCookie3.Secure   = base.ClientRequest.IsSecureConnection;
         base.ClientResponse.Cookies.Add(httpCookie3);
         HttpCookie httpCookie4 = new HttpCookie("DefaultAnchorMailbox", this.routingEmailAddress);
         httpCookie4.HttpOnly = true;
         httpCookie4.Secure   = base.ClientRequest.IsSecureConnection;
         base.ClientResponse.Cookies.Add(httpCookie4);
     }
     if (base.AnchoredRoutingTarget != null && E4eProxyRequestHandler.IsE4ePostOrRetrievePayloadRequest(base.ClientRequest) && this.IsBackEndCookieAndHeaderFlightEnabled())
     {
         string itemIdFromCookie = E4eProxyRequestHandler.GetItemIdFromCookie(base.ServerResponse);
         if (itemIdFromCookie != null)
         {
             string     fqdn        = base.AnchoredRoutingTarget.BackEndServer.Fqdn;
             string     value       = string.Format("{0}{1}{2}", itemIdFromCookie, '~', fqdn);
             HttpCookie httpCookie5 = new HttpCookie("X-E4eBackEnd", value);
             httpCookie5.HttpOnly = true;
             httpCookie5.Secure   = base.ClientRequest.IsSecureConnection;
             base.ClientResponse.Cookies.Add(httpCookie5);
         }
     }
     base.CopySupplementalCookiesToClientResponse();
 }
Ejemplo n.º 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);
                }
            }
        }