HttpWebRequest.platformnotsupported.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. //
  2. // System.Net.HttpWebRequest
  3. //
  4. // Author:
  5. // Rolf Bjarne Kvinge <[email protected]>
  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. using System.IO;
  29. using System.Net.Security;
  30. using System.Runtime.Serialization;
  31. using System.Security.Cryptography.X509Certificates;
  32. namespace System.Net
  33. {
  34. [Serializable]
  35. public class HttpWebRequest : WebRequest, ISerializable
  36. {
  37. internal const string EXCEPTION_MESSAGE = "System.Net.HttpWebRequest is not supported on the current platform.";
  38. internal WebConnection WebConnection {
  39. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  40. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  41. }
  42. #if MOBILE
  43. public
  44. #else
  45. internal
  46. #endif
  47. HttpWebRequest (Uri uri)
  48. {
  49. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  50. }
  51. internal HttpWebRequest (Uri uri, object /* IMonoTlsProvider */ tlsProvider, object /* MonoTlsSettings */ settings = null)
  52. {
  53. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  54. }
  55. protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
  56. {
  57. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  58. }
  59. public string Accept {
  60. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  61. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  62. }
  63. public Uri Address {
  64. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  65. }
  66. public bool AllowAutoRedirect {
  67. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  68. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  69. }
  70. public bool AllowWriteStreamBuffering {
  71. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  72. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  73. }
  74. public virtual bool AllowReadStreamBuffering {
  75. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  76. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  77. }
  78. public DecompressionMethods AutomaticDecompression {
  79. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  80. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  81. }
  82. internal bool InternalAllowBuffering {
  83. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  84. }
  85. internal Mono.Net.Security.IMonoTlsProvider TlsProvider {
  86. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  87. }
  88. internal Mono.Security.Interface.MonoTlsSettings TlsSettings {
  89. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  90. }
  91. public X509CertificateCollection ClientCertificates {
  92. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  93. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  94. }
  95. public string Connection {
  96. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  97. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  98. }
  99. public override string ConnectionGroupName {
  100. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  101. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  102. }
  103. public override long ContentLength {
  104. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  105. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  106. }
  107. internal long InternalContentLength {
  108. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  109. }
  110. public override string ContentType {
  111. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  112. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  113. }
  114. public HttpContinueDelegate ContinueDelegate {
  115. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  116. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  117. }
  118. public virtual CookieContainer CookieContainer {
  119. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  120. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  121. }
  122. public override ICredentials Credentials {
  123. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  124. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  125. }
  126. public DateTime Date {
  127. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  128. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  129. }
  130. #if !MOBILE
  131. public static new RequestCachePolicy DefaultCachePolicy {
  132. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  133. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  134. }
  135. #endif
  136. public static int DefaultMaximumErrorResponseLength {
  137. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  138. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  139. }
  140. public string Expect {
  141. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  142. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  143. }
  144. public virtual bool HaveResponse {
  145. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  146. }
  147. public override WebHeaderCollection Headers {
  148. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  149. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  150. }
  151. public string Host {
  152. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  153. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  154. }
  155. public DateTime IfModifiedSince {
  156. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  157. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  158. }
  159. public bool KeepAlive {
  160. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  161. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  162. }
  163. public int MaximumAutomaticRedirections {
  164. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  165. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  166. }
  167. public int MaximumResponseHeadersLength {
  168. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  169. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  170. }
  171. public static int DefaultMaximumResponseHeadersLength {
  172. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  173. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  174. }
  175. public int ReadWriteTimeout {
  176. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  177. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  178. }
  179. public int ContinueTimeout {
  180. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  181. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  182. }
  183. public string MediaType {
  184. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  185. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  186. }
  187. public override string Method {
  188. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  189. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  190. }
  191. public bool Pipelined {
  192. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  193. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  194. }
  195. public override bool PreAuthenticate {
  196. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  197. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  198. }
  199. public Version ProtocolVersion {
  200. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  201. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  202. }
  203. public override IWebProxy Proxy {
  204. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  205. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  206. }
  207. public string Referer {
  208. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  209. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  210. }
  211. public override Uri RequestUri {
  212. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  213. }
  214. public bool SendChunked {
  215. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  216. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  217. }
  218. public ServicePoint ServicePoint {
  219. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  220. }
  221. internal ServicePoint ServicePointNoLock {
  222. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  223. }
  224. public virtual bool SupportsCookieContainer {
  225. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  226. }
  227. public override int Timeout {
  228. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  229. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  230. }
  231. public string TransferEncoding {
  232. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  233. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  234. }
  235. public override bool UseDefaultCredentials {
  236. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  237. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  238. }
  239. public string UserAgent {
  240. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  241. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  242. }
  243. public bool UnsafeAuthenticatedConnectionSharing {
  244. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  245. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  246. }
  247. internal bool ExpectContinue {
  248. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  249. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  250. }
  251. internal ServerCertValidationCallback ServerCertValidationCallback {
  252. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  253. }
  254. internal Uri AuthUri {
  255. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  256. }
  257. public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
  258. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  259. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  260. }
  261. public void AddRange (int range)
  262. {
  263. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  264. }
  265. public void AddRange (int from, int to)
  266. {
  267. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  268. }
  269. public void AddRange (string rangeSpecifier, int range)
  270. {
  271. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  272. }
  273. public void AddRange (string rangeSpecifier, int from, int to)
  274. {
  275. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  276. }
  277. public void AddRange (long range)
  278. {
  279. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  280. }
  281. public void AddRange (long from, long to)
  282. {
  283. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  284. }
  285. public void AddRange (string rangeSpecifier, long range)
  286. {
  287. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  288. }
  289. public void AddRange (string rangeSpecifier, long from, long to)
  290. {
  291. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  292. }
  293. public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
  294. {
  295. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  296. }
  297. public override Stream EndGetRequestStream (IAsyncResult asyncResult)
  298. {
  299. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  300. }
  301. public override Stream GetRequestStream()
  302. {
  303. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  304. }
  305. public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
  306. {
  307. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  308. }
  309. public override WebResponse EndGetResponse (IAsyncResult asyncResult)
  310. {
  311. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  312. }
  313. public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext transportContext)
  314. {
  315. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  316. }
  317. public override WebResponse GetResponse()
  318. {
  319. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  320. }
  321. internal bool FinishedReading {
  322. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  323. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  324. }
  325. internal bool Aborted {
  326. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  327. }
  328. public override void Abort ()
  329. {
  330. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  331. }
  332. void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
  333. {
  334. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  335. }
  336. protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
  337. {
  338. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  339. }
  340. internal void DoContinueDelegate (int statusCode, WebHeaderCollection headers)
  341. {
  342. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  343. }
  344. internal void SetWriteStreamError (WebExceptionStatus status, Exception exc)
  345. {
  346. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  347. }
  348. internal byte[] GetRequestHeaders ()
  349. {
  350. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  351. }
  352. internal void SetWriteStream (WebConnectionStream stream)
  353. {
  354. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  355. }
  356. internal void SetResponseData (WebConnectionData data)
  357. {
  358. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  359. }
  360. internal void SetResponseError (WebExceptionStatus status, Exception e, string where)
  361. {
  362. throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
  363. }
  364. internal bool ReuseConnection {
  365. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  366. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  367. }
  368. internal WebConnection StoredConnection {
  369. get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  370. set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
  371. }
  372. }
  373. }