public ProxyUriQueue(ProxyUri uri)
		{
			this.head = -1;
			base..ctor();
			if (uri == null)
			{
				throw new ArgumentNullException();
			}
			this.data = new ProxyUri[1];
			this.data[0] = uri;
		}
Beispiel #2
0
 // 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));
     }
 }
		public ProxyUri Pop()
		{
			this.head++;
			if (this.head >= this.data.Length)
			{
				this.head = 0;
			}
			ProxyUri proxyUri = this.data[this.head];
			if (!proxyUri.IsParsed)
			{
				proxyUri.Parse();
			}
			return proxyUri;
		}
Beispiel #4
0
        // Token: 0x06001201 RID: 4609 RVA: 0x0006D43C File Offset: 0x0006B63C
        private bool CheckAndHandleConnectionFailure(WebException webException, Exception outerException)
        {
            ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyEventHandler.HandleConnectionFailure");
            if (outerException == null)
            {
                outerException = webException;
            }
            if (!ProxyEventHandler.IsConnectionFailure(webException))
            {
                return(false);
            }
            ExTraceGlobals.ProxyTracer.TraceDebug((long)this.GetHashCode(), "The proxy attempt failed, so we'll fail over to another CAS");
            this.attemptedProxyUriCount++;
            if (base.OwaContext.ProxyUriQueue.Count == 1 || this.attemptedProxyUriCount > base.OwaContext.ProxyUriQueue.Count)
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ProxyErrorCASFailoverAllAttemptsFailed, base.OwaContext.SecondCasUri.ToString(), new object[]
                {
                    base.OwaContext.LocalHostName,
                    base.OwaContext.SecondCasUri.ToString(),
                    string.Format("webExceptionStatus={0}", webException.Status)
                });
                OwaProxyException exception = new OwaProxyException("None of the CAS servers are responding", LocalizedStrings.GetNonEncoded(-200732695), outerException, false);
                this.asyncResult.CompleteRequest(false, exception);
                return(true);
            }
            ProxyUri secondCasUri = base.OwaContext.SecondCasUri;

            this.GetNextFailoverCas();
            OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ProxyErrorCASFailoverTryNextOne, secondCasUri.ToString(), new object[]
            {
                base.OwaContext.LocalHostName,
                secondCasUri.ToString(),
                base.OwaContext.SecondCasUri.ToString(),
                string.Format("webExceptionStatus={0}", webException.Status)
            });
            bool result;

            try
            {
                this.SendProxyRequest();
                result = true;
            }
            catch (Exception exception2)
            {
                this.asyncResult.CompleteRequest(false, exception2);
                result = true;
            }
            return(result);
        }
Beispiel #5
0
        // Token: 0x06001202 RID: 4610 RVA: 0x0006D5E8 File Offset: 0x0006B7E8
        private void GetNextFailoverCas()
        {
            ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyEventHandler.GetNextFailoverCas");
            bool flag = false;

            try
            {
                base.OwaContext.UserContext.Lock();
                flag = true;
                ProxyUriQueue proxyUriQueue = base.UserContext.ProxyUriQueue;
                if (proxyUriQueue.Head != base.OwaContext.SecondCasUri)
                {
                    base.OwaContext.SecondCasUri = proxyUriQueue.Head;
                }
                else
                {
                    ProxyUri proxyUri = proxyUriQueue.Pop();
                    if (!proxyUri.IsValid)
                    {
                        ProxyUtilities.ThrowMalformedCasUriException(base.OwaContext, proxyUri.ToString());
                    }
                    ProxyUtilities.EnsureProxyUrlSslPolicy(base.OwaContext, proxyUri);
                    base.OwaContext.SecondCasUri = proxyUri;
                    ExTraceGlobals.ProxyTracer.TraceDebug <ProxyUri>((long)this.GetHashCode(), "SecondCasUri = {0}", base.OwaContext.SecondCasUri);
                }
                this.proxyRequestUrl = new UriBuilder(this.proxyRequestUrl)
                {
                    Scheme = base.OwaContext.SecondCasUri.Uri.Scheme,
                    Host   = base.OwaContext.SecondCasUri.Uri.Host,
                    Port   = base.OwaContext.SecondCasUri.Uri.Port
                }.Uri;
                this.proxyLogonAttempts = 0;
            }
            finally
            {
                if (base.OwaContext.UserContext.LockedByCurrentThread() && flag)
                {
                    base.OwaContext.UserContext.Unlock();
                }
            }
        }
		public ProxyUriQueue(string uriString) : this(ProxyUri.Create(uriString))
		{
		}
Beispiel #7
0
 private static void SetOwaContextDestinationUrl(OwaContext owaContext, string redirectUrl)
 {
     owaContext.SecondCasUri = ProxyUri.Create(redirectUrl);
     owaContext.SecondCasUri.NeedVdirValidation = false;
     owaContext.SecondCasUri.Parse();
 }
Beispiel #8
0
 // Token: 0x0600124D RID: 4685 RVA: 0x0006FCF7 File Offset: 0x0006DEF7
 public static ProxyUri Create(string uriString)
 {
     return(ProxyUri.Create(uriString, null));
 }