[System*] Throw a PlatformNotSupported exception when using the managed networking...
[mono.git] / mcs / class / System / System.Net / HttpWebRequest.platformnotsupported.cs
1 //
2 // System.Net.HttpWebRequest
3 //
4 // Author:
5 //      Rolf Bjarne Kvinge <rolf@xamarin.com>
6 //
7 // Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using System.IO;
30 using System.Net.Security;
31 using System.Runtime.Serialization;
32 using System.Security.Cryptography.X509Certificates;
33
34 namespace System.Net
35 {
36         [Serializable]
37         public class HttpWebRequest : WebRequest, ISerializable
38         {
39                 internal const string EXCEPTION_MESSAGE = "System.Net.HttpWebRequest is not supported on the current platform.";
40
41 #if MOBILE
42                 public
43 #else
44                 internal
45 #endif
46                 HttpWebRequest (Uri uri)
47                 {
48                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
49                 }
50
51                 internal HttpWebRequest (Uri uri, object /* IMonoTlsProvider */ tlsProvider, object /* MonoTlsSettings */ settings = null)
52                 {
53                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
54                 }
55
56                 protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
57                 {
58                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
59                 }
60
61                 public string Accept {
62                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
63                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
64                 }
65
66                 public Uri Address {
67                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
68                 }
69
70                 public bool AllowAutoRedirect {
71                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
72                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
73                 }
74
75                 public bool AllowWriteStreamBuffering {
76                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
77                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
78                 }
79
80                 public virtual bool AllowReadStreamBuffering {
81                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
82                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
83                 }
84
85                 public DecompressionMethods AutomaticDecompression {
86                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
87                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
88                 }
89
90                 internal bool InternalAllowBuffering {
91                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
92                 }
93
94                 public X509CertificateCollection ClientCertificates {
95                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
96                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
97                 }
98
99                 public string Connection {
100                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
101                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
102                 }
103
104                 public override string ConnectionGroupName {
105                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
106                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
107                 }
108
109                 public override long ContentLength {
110                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
111                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
112                 }
113
114                 internal long InternalContentLength {
115                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
116                 }
117
118                 public override string ContentType {
119                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
120                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
121                 }
122
123                 public HttpContinueDelegate ContinueDelegate {
124                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
125                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
126                 }
127
128                 public virtual CookieContainer CookieContainer {
129                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
130                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
131                 }
132
133                 public override ICredentials Credentials {
134                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
135                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
136                 }
137
138                 public DateTime Date {
139                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
140                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
141                 }
142
143 #if !MOBILE
144                 public static new RequestCachePolicy DefaultCachePolicy {
145                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
146                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
147                 }
148 #endif
149
150                 public static int DefaultMaximumErrorResponseLength {
151                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
152                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
153                 }
154
155                 public string Expect {
156                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
157                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
158                 }
159
160                 public virtual bool HaveResponse {
161                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
162                 }
163
164                 public override WebHeaderCollection Headers {
165                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
166                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
167                 }
168
169                 public string Host {
170                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
171                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
172                 }
173
174                 public DateTime IfModifiedSince {
175                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
176                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
177                 }
178
179                 public bool KeepAlive {
180                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
181                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
182                 }
183
184                 public int MaximumAutomaticRedirections {
185                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
186                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
187                 }
188
189                 public int MaximumResponseHeadersLength {
190                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
191                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
192                 }
193
194                 public static int DefaultMaximumResponseHeadersLength {
195                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
196                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
197                 }
198
199                 public int ReadWriteTimeout {
200                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
201                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
202                 }
203
204                 public int ContinueTimeout {
205                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
206                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
207                 }
208
209                 public string MediaType {
210                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
211                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
212                 }
213
214                 public override string Method {
215                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
216                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
217                 }
218
219                 public bool Pipelined {
220                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
221                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
222                 }
223
224                 public override bool PreAuthenticate {
225                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
226                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
227                 }
228
229                 public Version ProtocolVersion {
230                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
231                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
232                 }
233
234                 public override IWebProxy Proxy {
235                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
236                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
237                 }
238
239                 public string Referer {
240                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
241                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
242                 }
243
244                 public override Uri RequestUri {
245                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
246                 }
247
248                 public bool SendChunked {
249                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
250                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
251                 }
252
253                 public ServicePoint ServicePoint {
254                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
255                 }
256
257                 internal ServicePoint ServicePointNoLock {
258                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
259                 }
260
261                 public virtual bool SupportsCookieContainer {
262                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
263                 }
264
265                 public override int Timeout {
266                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
267                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
268                 }
269
270                 public string TransferEncoding {
271                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
272                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
273                 }
274
275                 public override bool UseDefaultCredentials {
276                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
277                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
278                 }
279
280                 public string UserAgent {
281                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
282                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
283                 }
284
285                 public bool UnsafeAuthenticatedConnectionSharing {
286                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
287                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
288                 }
289
290                 internal bool ExpectContinue {
291                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
292                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
293                 }
294
295                 internal ServerCertValidationCallback ServerCertValidationCallback {
296                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
297                 }
298
299                 internal Uri AuthUri {
300                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
301                 }
302
303                 public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
304                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
305                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
306                 }
307
308                 public void AddRange (int range)
309                 {
310                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
311                 }
312
313                 public void AddRange (int from, int to)
314                 {
315                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
316                 }
317
318                 public void AddRange (string rangeSpecifier, int range)
319                 {
320                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
321                 }
322
323                 public void AddRange (string rangeSpecifier, int from, int to)
324                 {
325                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
326                 }
327
328                 public void AddRange (long range)
329                 {
330                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
331                 }
332
333                 public void AddRange (long from, long to)
334                 {
335                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
336                 }
337
338                 public void AddRange (string rangeSpecifier, long range)
339                 {
340                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
341                 }
342
343                 public void AddRange (string rangeSpecifier, long from, long to)
344                 {
345                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
346                 }
347
348                 public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
349                 {
350                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
351                 }
352
353                 public override Stream EndGetRequestStream (IAsyncResult asyncResult)
354                 {
355                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
356                 }
357
358                 public override Stream GetRequestStream()
359                 {
360                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
361                 }
362
363                 public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
364                 {
365                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
366                 }
367
368                 public override WebResponse EndGetResponse (IAsyncResult asyncResult)
369                 {
370                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
371                 }
372
373                 public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext transportContext)
374                 {
375                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
376                 }
377
378                 public override WebResponse GetResponse()
379                 {
380                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
381                 }
382
383                 internal bool FinishedReading {
384                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
385                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
386                 }
387
388                 internal bool Aborted {
389                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
390                 }
391
392                 public override void Abort ()
393                 {
394                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
395                 }
396
397                 void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
398                 {
399                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
400                 }
401
402                 protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
403                 {
404                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
405                 }
406
407                 internal void DoContinueDelegate (int statusCode, WebHeaderCollection headers)
408                 {
409                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
410                 }
411
412                 internal void SetWriteStreamError (WebExceptionStatus status, Exception exc)
413                 {
414                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
415                 }
416
417                 internal byte[] GetRequestHeaders ()
418                 {
419                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
420                 }
421         }
422 }