Ejemplo n.º 1
0
        public HostedHttpContext(HttpChannelListener listener, HostedHttpRequestAsyncResult result)
            : base(listener, null, result.EventTraceActivity)
        {
            AspNetPartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();

            this.result = result;
            result.AddRefForImpersonation();
        }
Ejemplo n.º 2
0
        public HostedHttpContext(HttpChannelListener listener, HostedHttpRequestAsyncResult result)
            : base(listener, null, result.EventTraceActivity)
        {
            AspNetPartialTrustHelpers.FailIfInPartialTrustOutsideAspNet();

            this.result = result;
            result.AddRefForImpersonation();
        }
Ejemplo n.º 3
0
		public HttpReplyChannel (HttpChannelListener<IReplyChannel> listener)
			: base (listener)
		{
			this.source = listener;

			if (listener.SecurityTokenManager != null) {
				var str = new SecurityTokenRequirement () { TokenType = SecurityTokenTypes.UserName };
				security_token_authenticator = listener.SecurityTokenManager.CreateSecurityTokenAuthenticator (str, out security_token_resolver);
			}
		}
        internal SharedHttpTransportManager(Uri listenUri, HttpChannelListener channelListener)
            : base(listenUri, channelListener.HostNameComparisonMode, channelListener.Realm)
        {
            this.onGetContext = Fx.ThunkCallback(new AsyncCallback(OnGetContext));
            this.onMessageDequeued = new Action(OnMessageDequeued);
            this.unsafeConnectionNtlmAuthentication = channelListener.UnsafeConnectionNtlmAuthentication;
            this.onContextReceived = new AsyncCallback(this.HandleHttpContextReceived);
            this.listenerRWLock = new ReaderWriterLockSlim();

            this.maxPendingAccepts = channelListener.MaxPendingAccepts;
        }
        static void EndHttpContextReceived(IAsyncResult httpContextReceivedResult)
        {
            using (DiagnosticUtility.ShouldUseActivity ? (ActivityHolder)httpContextReceivedResult.AsyncState : null)
            {
                HttpChannelListener channelListener =
                    (DiagnosticUtility.ShouldUseActivity ?
                     ((ActivityHolder)httpContextReceivedResult.AsyncState).context :
                     (HttpRequestContext)httpContextReceivedResult.AsyncState).Listener;

                channelListener.EndHttpContextReceived(httpContextReceivedResult);
            }
        }
        // We are NOT checking the RequestInitializationTimeout here since the HttpChannelListener should be handle them
        // individually. However, some of the scenarios might be impacted, e.g., if we have one endpoint with high RequestInitializationTimeout
        // and the other is just normal, the first endpoint might be occupying all the receiving loops, then the requests to the normal endpoint
        // will experience timeout issues. The mitigation for this issue is that customers should be able to increase the MaxPendingAccepts number.
        internal override bool IsCompatible(HttpChannelListener channelListener)
        {
            if (channelListener.InheritBaseAddressSettings)
                return true;

            if (!channelListener.IsScopeIdCompatible(HostNameComparisonMode, this.ListenUri))
            {
                return false;
            }

            if (this.maxPendingAccepts != channelListener.MaxPendingAccepts)
            {
                return false;
            }

            return channelListener.UnsafeConnectionNtlmAuthentication == this.unsafeConnectionNtlmAuthentication
                && base.IsCompatible(channelListener);
        }
 protected HttpRequestContext(HttpChannelListener listener, Message requestMessage, EventTraceActivity eventTraceActivity)
     : base(requestMessage, listener.InternalCloseTimeout, listener.InternalSendTimeout)
 {
     this.listener = listener;
     this.eventTraceActivity = eventTraceActivity;
 }
 internal static HttpRequestContext CreateContext(HttpChannelListener listener, HttpListenerContext listenerContext, EventTraceActivity eventTraceActivity)
 {
     return new ListenerHttpContext(listener, listenerContext, eventTraceActivity);
 }
 public HostedHttpContext(HttpChannelListener listener, HostedHttpRequestAsyncResult result) : base(listener, null)
 {
     this.result = result;
 }
 internal SharedHttpTransportManager(Uri listenUri, HttpChannelListener channelListener) : base(listenUri, channelListener.HostNameComparisonMode, channelListener.Realm)
 {
     this.onGetContext = Fx.ThunkCallback(new AsyncCallback(this.OnGetContext));
     this.onMessageDequeued = new Action(this.OnMessageDequeued);
     this.unsafeConnectionNtlmAuthentication = channelListener.UnsafeConnectionNtlmAuthentication;
 }
 internal override bool IsCompatible(HttpChannelListener channelListener)
 {
     if (channelListener.InheritBaseAddressSettings)
     {
         return true;
     }
     if (!channelListener.IsScopeIdCompatible(base.HostNameComparisonMode, base.ListenUri))
     {
         return false;
     }
     return ((channelListener.UnsafeConnectionNtlmAuthentication == this.unsafeConnectionNtlmAuthentication) && base.IsCompatible(channelListener));
 }
 public ListenerHttpContext(HttpChannelListener listener, HttpListenerContext listenerContext) : base(listener, null)
 {
     this.listenerContext = listenerContext;
 }
        protected bool TryLookupUri(Uri requestUri, string requestMethod,
                    HostNameComparisonMode hostNameComparisonMode, bool isWebSocketRequest, out HttpChannelListener listener)
        {
            listener = null;

            if (isWebSocketRequest)
            {
                Fx.Assert(StringComparer.OrdinalIgnoreCase.Compare(requestMethod, "GET") == 0, "The requestMethod must be GET in WebSocket case.");
                requestMethod = WebSocketTransportSettings.WebSocketMethod;
            }
            
            if (requestMethod == null)
            {
                requestMethod = string.Empty;
            }

            UriPrefixTable<HttpChannelListener> addressTable;
            Dictionary<string, UriPrefixTable<HttpChannelListener>> localAddressTables = addressTables;

            // check for a method match if necessary
            HttpChannelListener methodListener = null;
            if (requestMethod.Length > 0)
            {
                if (localAddressTables.TryGetValue(requestMethod, out addressTable))
                {
                    if (addressTable.TryLookupUri(requestUri, hostNameComparisonMode, out methodListener)
                        && string.Compare(requestUri.AbsolutePath, methodListener.Uri.AbsolutePath, StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        methodListener = null;
                    }
                }
            }
            // and also check the wildcard bucket 
            if (localAddressTables.TryGetValue(string.Empty, out addressTable)
                && addressTable.TryLookupUri(requestUri, hostNameComparisonMode, out listener))
            {
                if (methodListener != null && methodListener.Uri.AbsoluteUri.Length >= listener.Uri.AbsoluteUri.Length)
                {
                    listener = methodListener;
                }
            }
            else
            {
                listener = methodListener;
            }

            return (listener != null);
        }
 protected bool TryLookupUri(Uri requestUri, string requestMethod, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode, out HttpChannelListener listener)
 {
     UriPrefixTable<HttpChannelListener> table;
     listener = null;
     if (requestMethod == null)
     {
         requestMethod = string.Empty;
     }
     Dictionary<string, UriPrefixTable<HttpChannelListener>> addressTables = this.addressTables;
     HttpChannelListener item = null;
     if (((requestMethod.Length > 0) && addressTables.TryGetValue(requestMethod, out table)) && (table.TryLookupUri(requestUri, hostNameComparisonMode, out item) && (string.Compare(requestUri.AbsolutePath, item.Uri.AbsolutePath, StringComparison.OrdinalIgnoreCase) != 0)))
     {
         item = null;
     }
     if (addressTables.TryGetValue(string.Empty, out table) && table.TryLookupUri(requestUri, hostNameComparisonMode, out listener))
     {
         if ((item != null) && (item.Uri.AbsoluteUri.Length >= listener.Uri.AbsoluteUri.Length))
         {
             listener = item;
         }
     }
     else
     {
         listener = item;
     }
     return (listener != null);
 }
 public HostedHttpContext(HttpChannelListener listener, HostedHttpRequestAsyncResult result) : base(listener, null)
 {
     this.result = result;
 }
 public SharedHttpsTransportManager(Uri listenUri, HttpChannelListener factory) : base(listenUri, factory)
 {
 }
 internal static HttpRequestContext CreateContext(HttpChannelListener listener, HttpListenerContext listenerContext)
 {
     return new ListenerHttpContext(listener, listenerContext);
 }
 public ListenerHttpContext(HttpChannelListener listener,
     HttpListenerContext listenerContext, EventTraceActivity eventTraceActivity)
     : base(listener, null, eventTraceActivity)
 {
     this.listenerContext = listenerContext;
 }
 internal override bool IsCompatible(HttpChannelListener factory)
 {
     return true;
 }
 internal override bool IsCompatible(HttpChannelListener factory)
 {
     return(true);
 }
Ejemplo n.º 21
0
		public HttpReplyChannel (HttpChannelListener<IReplyChannel> listener)
			: base (listener)
		{
			this.source = listener;
		}
 internal virtual bool IsCompatible(HttpChannelListener listener)
 {
     return ((this.hostNameComparisonMode == listener.HostNameComparisonMode) && (this.realm == listener.Realm));
 }
 protected HttpRequestContext(HttpChannelListener listener, Message requestMessage) : base(requestMessage, listener.InternalCloseTimeout, listener.InternalSendTimeout)
 {
     this.listener = listener;
 }