| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Configuration; |
| | | 6 | | using CoreWCF.Channels; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Configuration |
| | | 9 | | { |
| | | 10 | | public class NetHttpBindingElement : HttpBindingBaseElement |
| | | 11 | | { |
| | | 12 | | public NetHttpBindingElement(string name) |
| | 3 | 13 | | : base(name) |
| | | 14 | | { |
| | 3 | 15 | | } |
| | | 16 | | |
| | | 17 | | public NetHttpBindingElement() |
| | 3 | 18 | | : this(null) |
| | | 19 | | { |
| | 3 | 20 | | } |
| | | 21 | | |
| | | 22 | | [ConfigurationProperty(ConfigurationStrings.MessageEncoding, DefaultValue = NetHttpMessageEncoding.Binary)] |
| | | 23 | | public NetHttpMessageEncoding MessageEncoding |
| | | 24 | | { |
| | 4 | 25 | | get { return (NetHttpMessageEncoding)base[ConfigurationStrings.MessageEncoding]; } |
| | 0 | 26 | | set { base[ConfigurationStrings.MessageEncoding] = value; } |
| | | 27 | | } |
| | | 28 | | |
| | | 29 | | |
| | | 30 | | [ConfigurationProperty(ConfigurationStrings.ReliableSession)] |
| | | 31 | | public string ReliableSession |
| | | 32 | | { |
| | 0 | 33 | | get { throw new PlatformNotSupportedException(); } |
| | | 34 | | } |
| | | 35 | | |
| | | 36 | | |
| | | 37 | | [ConfigurationProperty(ConfigurationStrings.Security)] |
| | | 38 | | public BasicHttpSecurityElement Security |
| | | 39 | | { |
| | 5 | 40 | | get { return (BasicHttpSecurityElement)base[ConfigurationStrings.Security]; } |
| | | 41 | | } |
| | | 42 | | |
| | | 43 | | // todo how to implement ? WebSocketSettings is internal |
| | | 44 | | [ConfigurationProperty(ConfigurationStrings.WebSocketSettingsSectionName)] |
| | | 45 | | public NetHttpWebSocketTransportSettingsElement WebSocketSettings |
| | | 46 | | { |
| | 0 | 47 | | get { return (NetHttpWebSocketTransportSettingsElement)base[ConfigurationStrings.WebSocketSettingsSectionNam |
| | 0 | 48 | | set { base[ConfigurationStrings.WebSocketSettingsSectionName] = value; } |
| | | 49 | | } |
| | | 50 | | |
| | | 51 | | public override Binding CreateBinding() |
| | | 52 | | { |
| | 2 | 53 | | var binding = new NetHttpBinding(Security.Mode) |
| | 2 | 54 | | { |
| | 2 | 55 | | Name = Name, |
| | 2 | 56 | | MaxReceivedMessageSize = MaxReceivedMessageSize, |
| | 2 | 57 | | MaxBufferSize = MaxBufferSize, |
| | 2 | 58 | | ReceiveTimeout = ReceiveTimeout, |
| | 2 | 59 | | CloseTimeout = CloseTimeout, |
| | 2 | 60 | | OpenTimeout = OpenTimeout, |
| | 2 | 61 | | SendTimeout = SendTimeout, |
| | 2 | 62 | | TransferMode = TransferMode, |
| | 2 | 63 | | TextEncoding = TextEncoding, |
| | 2 | 64 | | MessageEncoding = MessageEncoding, |
| | 2 | 65 | | ReaderQuotas = ReaderQuotas.Clone(), |
| | 2 | 66 | | }; |
| | | 67 | | |
| | 2 | 68 | | binding.MessageEncoding = MessageEncoding; |
| | | 69 | | //WebSocketSettings.ApplyConfiguration(netHttpBinding.WebSocketSettings); |
| | | 70 | | // this.ReliableSession.ApplyConfiguration(netHttpBinding.ReliableSession); |
| | 2 | 71 | | Security.ApplyConfiguration(binding.Security); |
| | 2 | 72 | | return binding; |
| | | 73 | | } |
| | | 74 | | } |
| | | 75 | | } |