Exemplo n.º 1
0
 internal IAsyncResult BeginProcessInboundRequest(
     ReplyChannelAcceptor replyChannelAcceptor,
     Action acceptorCallback,
     AsyncCallback callback,
     object state)
 {
     return(this.httpPipeline.BeginProcessInboundRequest(replyChannelAcceptor, acceptorCallback, callback, state));
 }
 internal override IAsyncResult BeginProcessInboundRequest(
     ReplyChannelAcceptor replyChannelAcceptor,
     Action dequeuedCallback,
     AsyncCallback callback,
     object state)
 {
     this.TraceBeginProcessInboundRequestStart();
     return(new EnqueueMessageAsyncResult(replyChannelAcceptor, dequeuedCallback, this, callback, state));
 }
            internal override IAsyncResult BeginProcessInboundRequest(ReplyChannelAcceptor replyChannelAcceptor, Action dequeuedCallback, AsyncCallback callback, object state)
            {
                try
                {
                    this.wasProcessInboundRequestSuccessful = false;
                    this.TraceProcessInboundRequestStart();
                    this.replyChannelAcceptor = replyChannelAcceptor;
                    this.dequeuedCallback     = dequeuedCallback;
                    HttpRequestMessageHttpInput httpRequestMessageInput = (HttpRequestMessageHttpInput)this.HttpInput;

                    this.httpRequestMessage = httpRequestMessageInput.HttpRequestMessage;
                    this.httpRequestMessage.Properties.Add(HttpPipelineKey, this);

                    lock (this.ThisLock)
                    {
                        this.transportIntegrationHandlerTask = this.transportIntegrationHandler.ProcessPipelineAsync(this.httpRequestMessage, this.cancellationTokenSource.Token);
                    }

                    this.SendHttpPipelineResponse();
                    this.TraceProcessInboundRequestStop();
                    this.wasProcessInboundRequestSuccessful = true;

                    return(new CompletedAsyncResult(callback, state));
                }
                catch (OperationCanceledException)
                {
                    if (TD.HttpPipelineFaultedIsEnabled())
                    {
                        TD.HttpPipelineFaulted(this.EventTraceActivity);
                    }

                    this.cancellationTokenSource.Cancel();
                    throw;
                }
                catch (Exception ex)
                {
                    if (!Fx.IsFatal(ex))
                    {
                        if (TD.HttpPipelineFaultedIsEnabled())
                        {
                            TD.HttpPipelineFaulted(this.EventTraceActivity);
                        }

                        this.SendAndClose(internalServerErrorHttpResponseMessage);
                    }

                    throw;
                }
            }
            public EnqueueMessageAsyncResult(
                ReplyChannelAcceptor acceptor,
                Action dequeuedCallback,
                HttpPipeline pipeline,
                AsyncCallback callback,
                object state)
                : base(callback, state)
            {
                this.pipeline         = pipeline;
                this.acceptor         = acceptor;
                this.dequeuedCallback = dequeuedCallback;

                AsyncCallback asynCallback = PrepareAsyncCompletion(HandleParseIncomingMessage);
                IAsyncResult  result       = this.pipeline.BeginParseIncomingMessage(asynCallback, this);

                this.SyncContinue(result);
            }
 public HttpChannelListener(HttpTransportBindingElement bindingElement, BindingContext context) : base(bindingElement, context, HttpTransportDefaults.GetDefaultMessageEncoderFactory(), bindingElement.HostNameComparisonMode)
 {
     if (bindingElement.TransferMode == System.ServiceModel.TransferMode.Buffered)
     {
         if (bindingElement.MaxReceivedMessageSize > 0x7fffffffL)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", System.ServiceModel.SR.GetString("MaxReceivedMessageSizeMustBeInIntegerRange")));
         }
         if (bindingElement.MaxBufferSize != bindingElement.MaxReceivedMessageSize)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("MaxBufferSizeMustMatchMaxReceivedMessageSize"));
         }
     }
     else if (bindingElement.MaxBufferSize > bindingElement.MaxReceivedMessageSize)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("MaxBufferSizeMustNotExceedMaxReceivedMessageSize"));
     }
     if ((bindingElement.AuthenticationScheme == AuthenticationSchemes.Basic) && (bindingElement.ExtendedProtectionPolicy.PolicyEnforcement == PolicyEnforcement.Always))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("ExtendedProtectionPolicyBasicAuthNotSupported")));
     }
     this.authenticationScheme       = bindingElement.AuthenticationScheme;
     this.keepAliveEnabled           = bindingElement.KeepAliveEnabled;
     base.InheritBaseAddressSettings = bindingElement.InheritBaseAddressSettings;
     this.maxBufferSize = bindingElement.MaxBufferSize;
     this.method        = bindingElement.Method;
     this.realm         = bindingElement.Realm;
     this.transferMode  = bindingElement.TransferMode;
     this.unsafeConnectionNtlmAuthentication = bindingElement.UnsafeConnectionNtlmAuthentication;
     this.credentialProvider       = context.BindingParameters.Find <SecurityCredentialsManager>();
     this.acceptor                 = new TransportReplyChannelAcceptor(this);
     this.securityCapabilities     = bindingElement.GetProperty <ISecurityCapabilities>(context);
     this.extendedProtectionPolicy = GetPolicyWithDefaultSpnCollection(bindingElement.ExtendedProtectionPolicy, this.authenticationScheme, base.HostNameComparisonModeInternal, base.Uri, out this.usingDefaultSpnList);
     if (bindingElement.AnonymousUriPrefixMatcher != null)
     {
         this.anonymousUriPrefixMatcher = new HttpAnonymousUriPrefixMatcher(bindingElement.AnonymousUriPrefixMatcher);
     }
 }
 internal abstract IAsyncResult BeginProcessInboundRequest(ReplyChannelAcceptor replyChannelAcceptor, Action dequeuedCallback, AsyncCallback callback, object state);