Merge pull request #498 from Unroll-Me/master
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel / HttpBindingBase.cs
1 //
2 // HttpBindingBase.cs
3 //
4 // Authors:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //      Martin Baulig <martin.baulig@xamarin.com>
7 //
8 // Copyright (C) 2005-2006 Novell, Inc.  http://www.novell.com
9 // Copyright 2011-2012 Xamarin Inc (http://www.xamarin.com).
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 using System;
31 using System.Collections.Generic;
32 using System.Net;
33 using System.Net.Security;
34 using System.ServiceModel.Channels;
35 using System.ServiceModel.Description;
36 using System.Text;
37 using System.Xml;
38 using System.ServiceModel.Configuration;
39
40 namespace System.ServiceModel
41 {
42         public abstract class HttpBindingBase : Binding,
43                 IBindingRuntimePreferences
44         {
45                 bool allow_cookies, bypass_proxy_on_local;
46                 HostNameComparisonMode host_name_comparison_mode
47                         = HostNameComparisonMode.StrongWildcard;
48                 long max_buffer_pool_size = 0x80000;
49                 int max_buffer_size = 0x10000;
50                 long max_recv_message_size = 0x10000;
51                 Uri proxy_address;
52                 XmlDictionaryReaderQuotas reader_quotas
53                         = new XmlDictionaryReaderQuotas ();
54                 EnvelopeVersion env_version = EnvelopeVersion.Soap11;
55                 Encoding text_encoding = new UTF8Encoding ();
56                 TransferMode transfer_mode
57                          = TransferMode.Buffered;
58                 bool use_default_web_proxy = true;
59
60                 public bool AllowCookies {
61                         get { return allow_cookies; }
62                         set { allow_cookies = value; }
63                 }
64
65                 public bool BypassProxyOnLocal {
66                         get { return bypass_proxy_on_local; }
67                         set { bypass_proxy_on_local = value; }
68                 }
69
70                 public HostNameComparisonMode HostNameComparisonMode {
71                         get { return host_name_comparison_mode; }
72                         set { host_name_comparison_mode = value; }
73                 }
74
75                 public long MaxBufferPoolSize {
76                         get { return max_buffer_pool_size; }
77                         set {
78                                 if (value <= 0)
79                                         throw new ArgumentOutOfRangeException ();
80                                 max_buffer_pool_size = value;
81                         }
82                 }
83
84                 public int MaxBufferSize {
85                         get { return max_buffer_size; }
86                         set {
87                                 if (value <= 0)
88                                         throw new ArgumentOutOfRangeException ();
89                                 max_buffer_size = value;
90                         }
91                 }
92
93                 public long MaxReceivedMessageSize {
94                         get { return max_recv_message_size; }
95                         set {
96                                 if (value <= 0)
97                                         throw new ArgumentOutOfRangeException ();
98                                 max_recv_message_size = value;
99                         }
100                 }
101
102                 public Uri ProxyAddress {
103                         get { return proxy_address; }
104                         set { proxy_address = value; }
105                 }
106
107                 public XmlDictionaryReaderQuotas ReaderQuotas {
108                         get { return reader_quotas; }
109                         set { reader_quotas = value; }
110                 }
111
112                 public override abstract string Scheme {
113                         get;
114                 }
115
116                 public EnvelopeVersion EnvelopeVersion {
117                         get { return env_version; }
118                 }
119
120                 public Encoding TextEncoding {
121                         get { return text_encoding; }
122                         set { text_encoding = value; }
123                 }
124
125                 public TransferMode TransferMode {
126                         get { return transfer_mode; }
127                         set { transfer_mode = value; }
128                 }
129
130                 public bool UseDefaultWebProxy {
131                         get { return use_default_web_proxy; }
132                         set { use_default_web_proxy = value; }
133                 }
134
135                 public override abstract BindingElementCollection CreateBindingElements ();
136
137                 // explicit interface implementations
138
139                 bool IBindingRuntimePreferences.ReceiveSynchronously {
140                         get { return false; }
141                 }
142         }
143 }