Merge pull request #3262 from lindenlab/add_continuations_test
[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 = default_text_encoding;
56                 static readonly Encoding default_text_encoding = new UTF8Encoding ();
57                 TransferMode transfer_mode
58                          = TransferMode.Buffered;
59                 bool use_default_web_proxy = true;
60
61                 public bool AllowCookies {
62                         get { return allow_cookies; }
63                         set { allow_cookies = value; }
64                 }
65
66                 public bool BypassProxyOnLocal {
67                         get { return bypass_proxy_on_local; }
68                         set { bypass_proxy_on_local = value; }
69                 }
70
71                 public HostNameComparisonMode HostNameComparisonMode {
72                         get { return host_name_comparison_mode; }
73                         set { host_name_comparison_mode = value; }
74                 }
75
76                 public long MaxBufferPoolSize {
77                         get { return max_buffer_pool_size; }
78                         set {
79                                 if (value <= 0)
80                                         throw new ArgumentOutOfRangeException ();
81                                 max_buffer_pool_size = value;
82                         }
83                 }
84
85                 public int MaxBufferSize {
86                         get { return max_buffer_size; }
87                         set {
88                                 if (value <= 0)
89                                         throw new ArgumentOutOfRangeException ();
90                                 max_buffer_size = value;
91                         }
92                 }
93
94                 public long MaxReceivedMessageSize {
95                         get { return max_recv_message_size; }
96                         set {
97                                 if (value <= 0)
98                                         throw new ArgumentOutOfRangeException ();
99                                 max_recv_message_size = value;
100                         }
101                 }
102
103                 public Uri ProxyAddress {
104                         get { return proxy_address; }
105                         set { proxy_address = value; }
106                 }
107
108                 public XmlDictionaryReaderQuotas ReaderQuotas {
109                         get { return reader_quotas; }
110                         set { reader_quotas = value; }
111                 }
112
113                 public override string Scheme {
114                         get;
115                 }
116
117                 public EnvelopeVersion EnvelopeVersion {
118                         get { return env_version; }
119                 }
120
121                 internal static Encoding DefaultTextEncoding {
122                         get { return default_text_encoding; }
123                 }
124
125                 public Encoding TextEncoding {
126                         get { return text_encoding; }
127                         set { text_encoding = value; }
128                 }
129
130                 public TransferMode TransferMode {
131                         get { return transfer_mode; }
132                         set { transfer_mode = value; }
133                 }
134
135                 public bool UseDefaultWebProxy {
136                         get { return use_default_web_proxy; }
137                         set { use_default_web_proxy = value; }
138                 }
139
140                 public override abstract BindingElementCollection CreateBindingElements ();
141
142                 // explicit interface implementations
143
144                 bool IBindingRuntimePreferences.ReceiveSynchronously {
145                         get { return false; }
146                 }
147         }
148 }