[System*] Throw a PlatformNotSupported exception when using the networking stack...
[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                 internal WebConnection WebConnection {
42                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
43                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
44                 }
45
46 #if MOBILE
47                 public
48 #else
49                 internal
50 #endif
51                 HttpWebRequest (Uri uri)
52                 {
53                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
54                 }
55
56                 internal HttpWebRequest (Uri uri, object /* IMonoTlsProvider */ tlsProvider, object /* MonoTlsSettings */ settings = null)
57                 {
58                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
59                 }
60
61                 protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
62                 {
63                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
64                 }
65
66                 public string Accept {
67                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
68                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
69                 }
70
71                 public Uri Address {
72                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
73                 }
74
75                 public bool AllowAutoRedirect {
76                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
77                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
78                 }
79
80                 public bool AllowWriteStreamBuffering {
81                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
82                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
83                 }
84
85                 public virtual bool AllowReadStreamBuffering {
86                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
87                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
88                 }
89
90                 public DecompressionMethods AutomaticDecompression {
91                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
92                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
93                 }
94
95                 internal bool InternalAllowBuffering {
96                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
97                 }
98
99                 internal Mono.Net.Security.IMonoTlsProvider TlsProvider {
100                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
101                 }
102
103                 internal Mono.Security.Interface.MonoTlsSettings TlsSettings {
104                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
105                 }
106
107                 public X509CertificateCollection ClientCertificates {
108                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
109                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
110                 }
111
112                 public string Connection {
113                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
114                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
115                 }
116
117                 public override string ConnectionGroupName {
118                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
119                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
120                 }
121
122                 public override long ContentLength {
123                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
124                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
125                 }
126
127                 internal long InternalContentLength {
128                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
129                 }
130
131                 public override string ContentType {
132                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
133                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
134                 }
135
136                 public HttpContinueDelegate ContinueDelegate {
137                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
138                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
139                 }
140
141                 public virtual CookieContainer CookieContainer {
142                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
143                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
144                 }
145
146                 public override ICredentials Credentials {
147                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
148                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
149                 }
150
151                 public DateTime Date {
152                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
153                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
154                 }
155
156 #if !MOBILE
157                 public static new RequestCachePolicy DefaultCachePolicy {
158                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
159                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
160                 }
161 #endif
162
163                 public static int DefaultMaximumErrorResponseLength {
164                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
165                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
166                 }
167
168                 public string Expect {
169                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
170                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
171                 }
172
173                 public virtual bool HaveResponse {
174                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
175                 }
176
177                 public override WebHeaderCollection Headers {
178                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
179                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
180                 }
181
182                 public string Host {
183                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
184                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
185                 }
186
187                 public DateTime IfModifiedSince {
188                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
189                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
190                 }
191
192                 public bool KeepAlive {
193                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
194                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
195                 }
196
197                 public int MaximumAutomaticRedirections {
198                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
199                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
200                 }
201
202                 public int MaximumResponseHeadersLength {
203                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
204                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
205                 }
206
207                 public static int DefaultMaximumResponseHeadersLength {
208                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
209                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
210                 }
211
212                 public int ReadWriteTimeout {
213                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
214                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
215                 }
216
217                 public int ContinueTimeout {
218                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
219                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
220                 }
221
222                 public string MediaType {
223                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
224                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
225                 }
226
227                 public override string Method {
228                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
229                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
230                 }
231
232                 public bool Pipelined {
233                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
234                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
235                 }
236
237                 public override bool PreAuthenticate {
238                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
239                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
240                 }
241
242                 public Version ProtocolVersion {
243                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
244                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
245                 }
246
247                 public override IWebProxy Proxy {
248                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
249                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
250                 }
251
252                 public string Referer {
253                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
254                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
255                 }
256
257                 public override Uri RequestUri {
258                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
259                 }
260
261                 public bool SendChunked {
262                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
263                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
264                 }
265
266                 public ServicePoint ServicePoint {
267                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
268                 }
269
270                 internal ServicePoint ServicePointNoLock {
271                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
272                 }
273
274                 public virtual bool SupportsCookieContainer {
275                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
276                 }
277
278                 public override int Timeout {
279                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
280                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
281                 }
282
283                 public string TransferEncoding {
284                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
285                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
286                 }
287
288                 public override bool UseDefaultCredentials {
289                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
290                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
291                 }
292
293                 public string UserAgent {
294                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
295                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
296                 }
297
298                 public bool UnsafeAuthenticatedConnectionSharing {
299                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
300                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
301                 }
302
303                 internal bool ExpectContinue {
304                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
305                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
306                 }
307
308                 internal ServerCertValidationCallback ServerCertValidationCallback {
309                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
310                 }
311
312                 internal Uri AuthUri {
313                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
314                 }
315
316                 public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
317                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
318                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
319                 }
320
321                 public void AddRange (int range)
322                 {
323                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
324                 }
325
326                 public void AddRange (int from, int to)
327                 {
328                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
329                 }
330
331                 public void AddRange (string rangeSpecifier, int range)
332                 {
333                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
334                 }
335
336                 public void AddRange (string rangeSpecifier, int from, int to)
337                 {
338                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
339                 }
340
341                 public void AddRange (long range)
342                 {
343                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
344                 }
345
346                 public void AddRange (long from, long to)
347                 {
348                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
349                 }
350
351                 public void AddRange (string rangeSpecifier, long range)
352                 {
353                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
354                 }
355
356                 public void AddRange (string rangeSpecifier, long from, long to)
357                 {
358                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
359                 }
360
361                 public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
362                 {
363                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
364                 }
365
366                 public override Stream EndGetRequestStream (IAsyncResult asyncResult)
367                 {
368                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
369                 }
370
371                 public override Stream GetRequestStream()
372                 {
373                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
374                 }
375
376                 public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
377                 {
378                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
379                 }
380
381                 public override WebResponse EndGetResponse (IAsyncResult asyncResult)
382                 {
383                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
384                 }
385
386                 public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext transportContext)
387                 {
388                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
389                 }
390
391                 public override WebResponse GetResponse()
392                 {
393                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
394                 }
395
396                 internal bool FinishedReading {
397                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
398                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
399                 }
400
401                 internal bool Aborted {
402                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
403                 }
404
405                 public override void Abort ()
406                 {
407                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
408                 }
409
410                 void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
411                 {
412                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
413                 }
414
415                 protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
416                 {
417                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
418                 }
419
420                 internal void DoContinueDelegate (int statusCode, WebHeaderCollection headers)
421                 {
422                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
423                 }
424
425                 internal void SetWriteStreamError (WebExceptionStatus status, Exception exc)
426                 {
427                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
428                 }
429
430                 internal byte[] GetRequestHeaders ()
431                 {
432                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
433                 }
434
435                 internal void SetWriteStream (WebConnectionStream stream)
436                 {
437                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
438                 }
439
440                 internal void SetResponseData (WebConnectionData data)
441                 {
442                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
443                 }
444
445                 internal void SetResponseError (WebExceptionStatus status, Exception e, string where)
446                 {
447                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
448                 }
449
450                 internal bool ReuseConnection {
451                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
452                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
453                 }
454
455                 internal WebConnection StoredConnection {
456                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
457                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
458                 }
459         }
460 }