public HttpTransportBindingElement() : base() { _allowCookies = HttpTransportDefaults.AllowCookies; _authenticationScheme = HttpTransportDefaults.AuthenticationScheme; _bypassProxyOnLocal = HttpTransportDefaults.BypassProxyOnLocal; _decompressionEnabled = HttpTransportDefaults.DecompressionEnabled; _hostNameComparisonMode = HttpTransportDefaults.HostNameComparisonMode; _keepAliveEnabled = HttpTransportDefaults.KeepAliveEnabled; _maxBufferSize = TransportDefaults.MaxBufferSize; _maxPendingAccepts = HttpTransportDefaults.DefaultMaxPendingAccepts; _method = string.Empty; _realm = HttpTransportDefaults.Realm; _requestInitializationTimeout = HttpTransportDefaults.RequestInitializationTimeout; _transferMode = HttpTransportDefaults.TransferMode; _unsafeConnectionNtlmAuthentication = HttpTransportDefaults.UnsafeConnectionNtlmAuthentication; _useDefaultWebProxy = HttpTransportDefaults.UseDefaultWebProxy; _webSocketSettings = HttpTransportDefaults.GetDefaultWebSocketTransportSettings(); }
public HttpTransportBindingElement() : base() { this.allowCookies = HttpTransportDefaults.AllowCookies; this.authenticationScheme = HttpTransportDefaults.AuthenticationScheme; this.bypassProxyOnLocal = HttpTransportDefaults.BypassProxyOnLocal; this.decompressionEnabled = HttpTransportDefaults.DecompressionEnabled; this.hostNameComparisonMode = HttpTransportDefaults.HostNameComparisonMode; this.keepAliveEnabled = HttpTransportDefaults.KeepAliveEnabled; this.maxBufferSize = TransportDefaults.MaxBufferSize; this.maxPendingAccepts = HttpTransportDefaults.DefaultMaxPendingAccepts; this.method = string.Empty; this.proxyAuthenticationScheme = HttpTransportDefaults.ProxyAuthenticationScheme; this.proxyAddress = HttpTransportDefaults.ProxyAddress; this.realm = HttpTransportDefaults.Realm; this.requestInitializationTimeout = HttpTransportDefaults.RequestInitializationTimeout; this.transferMode = HttpTransportDefaults.TransferMode; this.unsafeConnectionNtlmAuthentication = HttpTransportDefaults.UnsafeConnectionNtlmAuthentication; this.useDefaultWebProxy = HttpTransportDefaults.UseDefaultWebProxy; this.webSocketSettings = HttpTransportDefaults.GetDefaultWebSocketTransportSettings(); this.webProxy = null; this.extendedProtectionPolicy = ChannelBindingUtility.DefaultPolicy; }
internal HttpChannelFactory(HttpTransportBindingElement bindingElement, BindingContext context) : base(bindingElement, context, HttpTransportDefaults.GetDefaultMessageEncoderFactory()) { // validate setting interactions if (bindingElement.TransferMode == TransferMode.Buffered) { if (bindingElement.MaxReceivedMessageSize > int.MaxValue) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", SR.MaxReceivedMessageSizeMustBeInIntegerRange)); } if (bindingElement.MaxBufferSize != bindingElement.MaxReceivedMessageSize) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", SR.MaxBufferSizeMustMatchMaxReceivedMessageSize); } } else { if (bindingElement.MaxBufferSize > bindingElement.MaxReceivedMessageSize) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", SR.MaxBufferSizeMustNotExceedMaxReceivedMessageSize); } } if (TransferModeHelper.IsRequestStreamed(bindingElement.TransferMode) && bindingElement.AuthenticationScheme != AuthenticationSchemes.Anonymous) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", SR.HttpAuthDoesNotSupportRequestStreaming); } _allowCookies = bindingElement.AllowCookies; if (_allowCookies) { _httpCookieContainerManager = new HttpCookieContainerManager(); } if (!bindingElement.AuthenticationScheme.IsSingleton()) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR.Format(SR.HttpRequiresSingleAuthScheme, bindingElement.AuthenticationScheme)); } _authenticationScheme = bindingElement.AuthenticationScheme; _maxBufferSize = bindingElement.MaxBufferSize; _transferMode = bindingElement.TransferMode; _useDefaultWebProxy = bindingElement.UseDefaultWebProxy; _channelCredentials = context.BindingParameters.Find <SecurityCredentialsManager>(); _securityCapabilities = bindingElement.GetProperty <ISecurityCapabilities>(context); _webSocketSettings = WebSocketHelper.GetRuntimeWebSocketSettings(bindingElement.WebSocketSettings); int webSocketBufferSize = WebSocketHelper.ComputeClientBufferSize(MaxReceivedMessageSize); _bufferPool = new ConnectionBufferPool(webSocketBufferSize); _clientWebSocketFactory = ClientWebSocketFactory.GetFactory(); _webSocketSoapContentType = new Lazy <string>(() => MessageEncoderFactory.CreateSessionEncoder().ContentType, LazyThreadSafetyMode.ExecutionAndPublication); }
public bool ShouldSerializeWebSocketSettings() { return(!this.WebSocketSettings.Equals(HttpTransportDefaults.GetDefaultWebSocketTransportSettings())); }
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); } }