From e6536dd5e118a16cdca12840d6529ef9d01aaaad Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 27 Sep 2016 13:13:38 +0200 Subject: [PATCH] [System*] Throw a PlatformNotSupported exception when using the networking stack on watchOS. (#3606) * [System] Fix line endings for a few files. Best reviewed by not showing whitespace changes (should be empty diff in that case). * [System] Fix potential crash in CookieParserTests. Socket.EndAccept can throw an exception, which will crash the process if it happens on a threadpool. So handle any exceptions when calling Socket.EndAccept, and propagate those exceptions out of any threadpool code. * [System.Net.Http] Throw a PlatformNotSupported exception when using HttpClientHandler on watchOS. * [System.Net.Http] Tweak tests after watchOS API change. Unfortunately the [ExpectedException] attribute can't be put on an entire class, so remove the [Category ("RequiresBSDSockets")] attribute on the class and instead decorate each test with an [ExpectedException] attribute. * [System] Extract the HttpListenerResponseHelper class to a separate file. Extract the HttpListenerResponseHelper class to a separate file so that it's easier to replace the HttpListenerResponse implementation by using a different file. * [System] Throw a PlatformNotSupported exception when using the networking stack on watchOS. * [System] Tweak tests after watchOS API changes. Unfortunately the [ExpectedException] attribute can't be put on an entire class, so remove the [Category ("RequiresBSDSockets")] attribute on the class and instead decorate each test with an [ExpectedException] attribute. * [System] Fix potential crash in SocketAcceptAsyncTest. Fix potential crash in SocketAcceptAsyncTest by catching any exceptions in code executed on the threadpool so that we never end up with unhandled exceptions (which may terminate the process). * [System] Avoid logic in SetUp attributes in tests. Any type of exception in [SetUp] attributes causes all tests to fail with that exception. This even happens for tests that do not need the logic in the [SetUp] attribute. So rewrite tests a bit to not use [SetUp] when we can reasonably avoid it, and instead instantiate class-level variables on first use. This ensures that any exceptions that occur when initializing those variables are attributed to the corresponding test, and not all of them. * [System] Make exception handler (for test) catch more exceptions to avoid unhandled exceptions causing process termination. * [System] Remove Obsolete attribute on API that throws PNSE. --- mcs/build/profiles/monotouch_watch.make | 1 + .../profiles/monotouch_watch_runtime.make | 1 + .../HttpClientHandler.platformnotsupported.cs | 175 +++++++ .../System.Net.Http/HttpClientHandlerTest.cs | 12 + .../Test/System.Net.Http/HttpClientTest.cs | 100 +++- ..._watch_System.Net.Http.dll.exclude.sources | 1 + ...onotouch_watch_System.Net.Http.dll.sources | 2 + .../SmtpClient.platformnotsupported.cs | 167 +++++++ mcs/class/System/System.Net.Sockets/Socket.cs | 4 + .../TcpClient.platformnotsupported.cs | 191 ++++++++ .../TcpListener.platformnotsupported.cs | 135 +++++ .../UdpClient.platformnotsupported.cs | 241 +++++++++ .../ClientWebSocket.platformnotsupported.cs | 98 ++++ mcs/class/System/System.Net/Dns.cs | 24 + .../FtpRequestCreator.platformnotsupported.cs | 39 ++ .../FtpWebRequest.platformnotsupported.cs | 182 +++++++ .../FtpWebResponse.platformnotsupported.cs | 91 ++++ .../HttpListener.platformnotsupported.cs | 128 +++++ ...ttpListenerContext.platformnotsupported.cs | 68 +++ ...erPrefixCollection.platformnotsupported.cs | 93 ++++ ...ttpListenerRequest.platformnotsupported.cs | 180 +++++++ .../System/System.Net/HttpListenerResponse.cs | 58 --- ...tpListenerResponse.platformnotsupported.cs | 150 ++++++ .../System.Net/HttpListenerResponseHelper.cs | 88 ++++ .../HttpWebRequest.platformnotsupported.cs | 460 ++++++++++++++++++ .../HttpWebResponse.platformnotsupported.cs | 147 ++++++ mcs/class/System/System.dll.sources | 1 + .../Test/System.Net.Mail/SmtpClientTest.cs | 78 ++- .../Test/System.Net.Security/SslStreamTest.cs | 4 +- .../System.Net.Sockets/NetworkStreamTest.cs | 9 +- .../SocketAcceptAsyncTest.cs | 46 +- .../System.Net.Sockets/SocketAsyncTest.cs | 39 +- .../Test/System.Net.Sockets/SocketTest.cs | 205 +++++++- .../Test/System.Net.Sockets/TcpClientTest.cs | 17 +- .../System.Net.Sockets/TcpListenerTest.cs | 28 +- .../Test/System.Net.Sockets/UdpClientTest.cs | 122 ++++- .../ClientWebSocketTest.cs | 40 +- .../Test/System.Net/CookieParserTest.cs | 45 +- mcs/class/System/Test/System.Net/DnsTest.cs | 37 +- .../Test/System.Net/FileWebRequestTest.cs | 1 - .../Test/System.Net/FtpWebRequestTest.cs | 63 ++- .../Test/System.Net/HttpListener2Test.cs | 86 +++- .../HttpListenerPrefixCollectionTest.cs | 68 ++- .../System.Net/HttpListenerRequestTest.cs | 16 +- .../Test/System.Net/HttpListenerTest.cs | 125 ++++- .../Test/System.Net/HttpWebRequestTest.cs | 228 ++++++++- .../Test/System.Net/HttpWebResponseTest.cs | 92 +++- .../Test/System.Net/ServicePointTest.cs | 81 +-- .../System/Test/System.Net/WebClientTest.cs | 23 +- .../System.Net/WebHeaderCollectionTest.cs | 6 + .../System/Test/System.Net/WebRequestTest.cs | 122 +++-- mcs/class/System/mobile_System.dll.sources | 1 + ...monotouch_watch_System.dll.exclude.sources | 27 + .../System/monotouch_watch_System.dll.sources | 15 + 54 files changed, 4196 insertions(+), 265 deletions(-) create mode 100644 mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.platformnotsupported.cs create mode 100644 mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.exclude.sources create mode 100644 mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.sources create mode 100644 mcs/class/System/System.Net.Mail/SmtpClient.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net.Sockets/TcpClient.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net.Sockets/TcpListener.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net.Sockets/UdpClient.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/FtpRequestCreator.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/FtpWebRequest.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/FtpWebResponse.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/HttpListener.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/HttpListenerPrefixCollection.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/HttpListenerRequest.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/HttpListenerResponse.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/HttpListenerResponseHelper.cs create mode 100644 mcs/class/System/System.Net/HttpWebRequest.platformnotsupported.cs create mode 100644 mcs/class/System/System.Net/HttpWebResponse.platformnotsupported.cs create mode 100644 mcs/class/System/monotouch_watch_System.dll.exclude.sources diff --git a/mcs/build/profiles/monotouch_watch.make b/mcs/build/profiles/monotouch_watch.make index 0242c20bf51..02c934b62e6 100644 --- a/mcs/build/profiles/monotouch_watch.make +++ b/mcs/build/profiles/monotouch_watch.make @@ -1,6 +1,7 @@ include $(topdir)/build/profiles/monotouch.make PROFILE_MCS_FLAGS += \ + -d:FEATURE_NO_BSD_SOCKETS \ -d:MONOTOUCH_WATCH NO_THREAD_ABORT=1 diff --git a/mcs/build/profiles/monotouch_watch_runtime.make b/mcs/build/profiles/monotouch_watch_runtime.make index 7b3eb80a551..cb6bf304b99 100644 --- a/mcs/build/profiles/monotouch_watch_runtime.make +++ b/mcs/build/profiles/monotouch_watch_runtime.make @@ -1,6 +1,7 @@ include $(topdir)/build/profiles/monotouch_runtime.make PROFILE_MCS_FLAGS += \ + -d:FEATURE_NO_BSD_SOCKETS \ -d:MONOTOUCH_WATCH NO_THREAD_ABORT=1 diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.platformnotsupported.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.platformnotsupported.cs new file mode 100644 index 00000000000..eb5b7ffa820 --- /dev/null +++ b/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.platformnotsupported.cs @@ -0,0 +1,175 @@ +// +// System.Net.Http/HttpClientHandler.cs +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Collections.Generic; +using System.Net.Security; +using System.Security.Authentication; +using System.Security.Cryptography.X509Certificates; +using System.Threading.Tasks; +using System.Threading; + +namespace System.Net.Http +{ + public class HttpClientHandler : HttpMessageHandler + { + const string EXCEPTION_MESSAGE = "System.Net.Http.HttpClientHandler is not supported on the current platform."; + + public HttpClientHandler () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public bool AllowAutoRedirect { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public DecompressionMethods AutomaticDecompression { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public ClientCertificateOption ClientCertificateOptions { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public CookieContainer CookieContainer { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public ICredentials Credentials { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int MaxAutomaticRedirections { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public long MaxRequestContentBufferSize { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool PreAuthenticate { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public IWebProxy Proxy { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual bool SupportsAutomaticDecompression { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual bool SupportsProxy { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual bool SupportsRedirectConfiguration { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool UseCookies { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool UseDefaultCredentials { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool UseProxy { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + protected override void Dispose (bool disposing) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + HttpResponseMessage CreateResponseMessage (HttpWebResponse wr, HttpRequestMessage requestMessage, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected internal async override Task SendAsync (HttpRequestMessage request, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + +#if NETSTANDARD + public bool CheckCertificateRevocationList { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public X509CertificateCollection ClientCertificates { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public ICredentials DefaultProxyCredentials { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int MaxConnectionsPerServer { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int MaxResponseHeadersLength { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public IDictionary Properties { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Func ServerCertificateCustomValidationCallback { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public SslProtocols SslProtocols { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } +#endif + } +} diff --git a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientHandlerTest.cs b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientHandlerTest.cs index 78f8a0c225d..3f06e1c316d 100644 --- a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientHandlerTest.cs +++ b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientHandlerTest.cs @@ -61,6 +61,9 @@ namespace MonoTests.System.Net.Http } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Properties_Defaults () { var h = new HttpClientHandler (); @@ -83,6 +86,9 @@ namespace MonoTests.System.Net.Http } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Properties_Invalid () { var h = new HttpClientHandler (); @@ -107,6 +113,9 @@ namespace MonoTests.System.Net.Http } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Properties_AfterClientCreation () { var h = new HttpClientHandler (); @@ -119,6 +128,9 @@ namespace MonoTests.System.Net.Http } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Disposed () { var h = new HttpClientHandler (); diff --git a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs index f1af864e214..d9aab417dfa 100644 --- a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs +++ b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs @@ -263,6 +263,10 @@ namespace MonoTests.System.Net.Http [Test] +#if FEATURE_NO_BSD_SOCKETS + // Using HttpClientHandler, which indirectly requires BSD sockets. + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CancelRequestViaProxy () { var handler = new HttpClientHandler { @@ -321,7 +325,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Proxy_Disabled () { var pp = WebRequest.DefaultWebProxy; @@ -398,7 +404,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_Default () { bool? failed = null; @@ -443,7 +451,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_Version_1_0 () { bool? failed = null; @@ -491,7 +501,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_ClientHandlerSettings () { bool? failed = null; @@ -556,7 +568,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_CustomHeaders () { bool? failed = null; @@ -621,7 +635,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_CustomHeaders_SpecialSeparators () { bool? failed = null; @@ -656,7 +672,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_CustomHeaders_Host () { bool? failed = null; @@ -690,7 +708,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Transfer_Encoding_Chunked () { bool? failed = null; @@ -720,7 +740,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Transfer_Encoding_Custom () { bool? failed = null; @@ -749,7 +771,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_Content () { var listener = CreateListener (l => { @@ -777,7 +801,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_Content_MaxResponseContentBufferSize () { var listener = CreateListener (l => { @@ -800,7 +826,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_Content_MaxResponseContentBufferSize_Error () { var listener = CreateListener (l => { @@ -827,7 +855,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_NoContent () { foreach (var method in new HttpMethod[] { HttpMethod.Post, HttpMethod.Put, HttpMethod.Delete }) { @@ -860,7 +890,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Complete_Error () { var listener = CreateListener (l => { @@ -881,7 +913,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Content_Get () { var listener = CreateListener (l => { @@ -901,7 +935,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Content_BomEncoding () { var listener = CreateListener (l => { @@ -926,7 +962,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Content_Put () { bool passed = false; @@ -952,7 +990,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Content_Put_CustomStream () { bool passed = false; @@ -1055,7 +1095,9 @@ namespace MonoTests.System.Net.Http [Test] [Category ("MobileNotWorking")] // Missing encoding - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetString_Many () { Action context = (HttpListenerContext l) => { @@ -1085,7 +1127,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetByteArray_ServerError () { var listener = CreateListener (l => { @@ -1108,7 +1152,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DisallowAutoRedirect () { var listener = CreateListener (l => { @@ -1137,7 +1183,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void RequestUriAfterRedirect () { var listener = CreateListener (l => { @@ -1178,7 +1226,9 @@ namespace MonoTests.System.Net.Http } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif /* * Properties may only be modified before sending the first request. */ @@ -1209,6 +1259,10 @@ namespace MonoTests.System.Net.Http } [Test] +#if FEATURE_NO_BSD_SOCKETS + // Using HttpClientHandler, which indirectly requires BSD sockets. + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif /* * However, this policy is not enforced for custom handlers and there * is also no way a derived class could tell its HttpClientHandler parent diff --git a/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.exclude.sources b/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.exclude.sources new file mode 100644 index 00000000000..5c2ff8a54f8 --- /dev/null +++ b/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.exclude.sources @@ -0,0 +1 @@ +System.Net.Http/HttpClientHandler.cs diff --git a/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.sources b/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.sources new file mode 100644 index 00000000000..a9d766e5eda --- /dev/null +++ b/mcs/class/System.Net.Http/monotouch_watch_System.Net.Http.dll.sources @@ -0,0 +1,2 @@ +#include System.Net.Http.dll.sources +System.Net.Http/HttpClientHandler.platformnotsupported.cs diff --git a/mcs/class/System/System.Net.Mail/SmtpClient.platformnotsupported.cs b/mcs/class/System/System.Net.Mail/SmtpClient.platformnotsupported.cs new file mode 100644 index 00000000000..92ef97d96e2 --- /dev/null +++ b/mcs/class/System/System.Net.Mail/SmtpClient.platformnotsupported.cs @@ -0,0 +1,167 @@ +// +// System.Net.Mail.SmtpClient.cs +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.ComponentModel; +using System.Security.Cryptography.X509Certificates; +using System.Threading.Tasks; + +namespace System.Net.Mail { + public class SmtpClient + : IDisposable + { + const string EXCEPTION_MESSAGE = "System.Net.Mail.SmtpClient is not supported on the current platform."; + + public SmtpClient () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public SmtpClient (string host) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public SmtpClient (string host, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + +#if SECURITY_DEP + [MonoTODO("Client certificates not used")] + public X509CertificateCollection ClientCertificates { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } +#endif + + public string TargetName { get; set; } + + public ICredentialsByHost Credentials { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public SmtpDeliveryMethod DeliveryMethod { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool EnableSsl { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string Host { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string PickupDirectoryLocation { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int Port { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public SmtpDeliveryFormat DeliveryFormat { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public ServicePoint ServicePoint { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int Timeout { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool UseDefaultCredentials { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + +#pragma warning disable 0067 // The event `System.Net.Mail.SmtpClient.SendCompleted' is never used + public event SendCompletedEventHandler SendCompleted; +#pragma warning restore 0067 + + public void Dispose () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected virtual void Dispose (bool disposing) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected void OnSendCompleted (AsyncCompletedEventArgs e) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Send (MailMessage message) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Send (string from, string to, string subject, string body) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task SendMailAsync (MailMessage message) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task SendMailAsync (string from, string recipients, string subject, string body) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void SendAsync (MailMessage message, object userToken) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void SendAsync (string from, string to, string subject, string body, object userToken) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void SendAsyncCancel () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} + diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs index 7ac0ba39f46..e80e84ac7e8 100644 --- a/mcs/class/System/System.Net.Sockets/Socket.cs +++ b/mcs/class/System/System.Net.Sockets/Socket.cs @@ -877,6 +877,9 @@ namespace System.Net.Sockets public void Bind (EndPoint localEP) { +#if FEATURE_NO_BSD_SOCKETS + throw new PlatformNotSupportedException ("System.Net.Sockets.Socket:Bind is not supported on this platform."); +#else ThrowIfDisposedAndClosed (); if (localEP == null) @@ -896,6 +899,7 @@ namespace System.Net.Sockets is_bound = true; seed_endpoint = localEP; +#endif // FEATURE_NO_BSD_SOCKETS } private static void Bind_internal (SafeSocketHandle safeHandle, SocketAddress sa, out int error) diff --git a/mcs/class/System/System.Net.Sockets/TcpClient.platformnotsupported.cs b/mcs/class/System/System.Net.Sockets/TcpClient.platformnotsupported.cs new file mode 100644 index 00000000000..dd69a398fe1 --- /dev/null +++ b/mcs/class/System/System.Net.Sockets/TcpClient.platformnotsupported.cs @@ -0,0 +1,191 @@ +// +// System.Net.Sockets.TcpClient.cs +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Net; +using System.Threading.Tasks; + +namespace System.Net.Sockets +{ + public class TcpClient : IDisposable + { + const string EXCEPTION_MESSAGE = "System.Net.Sockets.TcpClient is not supported on the current platform."; + + public TcpClient () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public TcpClient (AddressFamily family) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public TcpClient (IPEndPoint localEP) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public TcpClient (string hostname, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected bool Active { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Socket Client { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int Available { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool Connected { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool ExclusiveAddressUse { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public LingerOption LingerState { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool NoDelay { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int ReceiveBufferSize { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int ReceiveTimeout { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int SendBufferSize { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int SendTimeout { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public void Close () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Connect (IPEndPoint remoteEP) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Connect (IPAddress address, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Connect (string hostname, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Connect (IPAddress[] ipAddresses, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void EndConnect (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginConnect (IPAddress address, int port, AsyncCallback requestCallback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginConnect (IPAddress[] addresses, int port, AsyncCallback requestCallback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginConnect (string host, int port, AsyncCallback requestCallback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Dispose () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected virtual void Dispose (bool disposing) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + ~TcpClient () + { + } + + public NetworkStream GetStream() + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task ConnectAsync (IPAddress address, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task ConnectAsync (IPAddress[] addresses, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task ConnectAsync (string host, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net.Sockets/TcpListener.platformnotsupported.cs b/mcs/class/System/System.Net.Sockets/TcpListener.platformnotsupported.cs new file mode 100644 index 00000000000..7b64967345f --- /dev/null +++ b/mcs/class/System/System.Net.Sockets/TcpListener.platformnotsupported.cs @@ -0,0 +1,135 @@ +// +// System.Net.Sockets.TcpListener.cs +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Net; +using System.Threading.Tasks; + +namespace System.Net.Sockets +{ + public class TcpListener + { + const string EXCEPTION_MESSAGE = "System.Net.Sockets.TcpListener is not supported on the current platform."; + + public TcpListener (int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public TcpListener (IPEndPoint localEP) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public TcpListener (IPAddress localaddr, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected bool Active { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public EndPoint LocalEndpoint { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Socket Server { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool ExclusiveAddressUse { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Socket AcceptSocket () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public TcpClient AcceptTcpClient () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + ~TcpListener () + { + } + + public bool Pending () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Start () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Start (int backlog) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginAcceptSocket (AsyncCallback callback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginAcceptTcpClient (AsyncCallback callback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Socket EndAcceptSocket (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public TcpClient EndAcceptTcpClient (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Stop () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task AcceptSocketAsync () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task AcceptTcpClientAsync () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net.Sockets/UdpClient.platformnotsupported.cs b/mcs/class/System/System.Net.Sockets/UdpClient.platformnotsupported.cs new file mode 100644 index 00000000000..953350146d2 --- /dev/null +++ b/mcs/class/System/System.Net.Sockets/UdpClient.platformnotsupported.cs @@ -0,0 +1,241 @@ +// +// System.Net.Sockets.UdpClient.cs +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Threading.Tasks; + +namespace System.Net.Sockets +{ + public class UdpClient : IDisposable + { + const string EXCEPTION_MESSAGE = "System.Net.Sockets.UdpClient is not supported on the current platform."; + + public UdpClient () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public UdpClient(AddressFamily family) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public UdpClient (int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public UdpClient (IPEndPoint localEP) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public UdpClient (int port, AddressFamily family) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public UdpClient (string hostname, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Close () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Connect (IPEndPoint endPoint) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Connect (IPAddress addr, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Connect (string hostname, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void DropMulticastGroup (IPAddress multicastAddr) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void DropMulticastGroup (IPAddress multicastAddr, int ifindex) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void JoinMulticastGroup (IPAddress multicastAddr) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void JoinMulticastGroup (int ifindex, IPAddress multicastAddr) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void JoinMulticastGroup (IPAddress multicastAddr, int timeToLive) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void JoinMulticastGroup (IPAddress multicastAddr, IPAddress localAddress) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public byte [] Receive (ref IPEndPoint remoteEP) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public int Send (byte [] dgram, int bytes) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public int Send (byte [] dgram, int bytes, IPEndPoint endPoint) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public int Send (byte [] dgram, int bytes, string hostname, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginSend (byte[] datagram, int bytes, AsyncCallback requestCallback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginSend (byte[] datagram, int bytes, IPEndPoint endPoint, AsyncCallback requestCallback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginSend (byte[] datagram, int bytes, string hostname, int port, AsyncCallback requestCallback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public int EndSend (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginReceive (AsyncCallback requestCallback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public byte[] EndReceive (IAsyncResult asyncResult, ref IPEndPoint remoteEP) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected bool Active { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Socket Client { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int Available { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool DontFragment { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool EnableBroadcast { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool ExclusiveAddressUse { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool MulticastLoopback { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public short Ttl { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public void Dispose () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected virtual void Dispose (bool disposing) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + ~UdpClient () + { + } + + public Task ReceiveAsync () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task SendAsync (byte[] datagram, int bytes) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task SendAsync (byte[] datagram, int bytes, IPEndPoint endPoint) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task SendAsync (byte[] datagram, int bytes, string hostname, int port) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs b/mcs/class/System/System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs new file mode 100644 index 00000000000..324ae421122 --- /dev/null +++ b/mcs/class/System/System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs @@ -0,0 +1,98 @@ +// +// ClientWebSocket.cs +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.WebSockets +{ + public class ClientWebSocket : WebSocket, IDisposable + { + const string EXCEPTION_MESSAGE = "System.Net.WebSockets.ClientWebSocket is not supported on the current platform."; + + public ClientWebSocket () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override void Dispose () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override void Abort () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public ClientWebSocketOptions Options { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override WebSocketState State { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override WebSocketCloseStatus? CloseStatus { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override string CloseStatusDescription { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override string SubProtocol { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Task ConnectAsync (Uri uri, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Task SendAsync (ArraySegment buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Task ReceiveAsync (ArraySegment buffer, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Task CloseAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Task CloseOutputAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net/Dns.cs b/mcs/class/System/System.Net/Dns.cs index 9045052ccf7..806bfc119d6 100644 --- a/mcs/class/System/System.Net/Dns.cs +++ b/mcs/class/System/System.Net/Dns.cs @@ -130,6 +130,9 @@ namespace System.Net { [Obsolete ("Use BeginGetHostEntry instead")] public static IAsyncResult BeginGetHostByName (string hostName, AsyncCallback requestCallback, object stateObject) { +#if FEATURE_NO_BSD_SOCKETS + throw new PlatformNotSupportedException ("System.Net.Dns:BeginGetHostByName is not supported on this platform."); +#else if (hostName == null) throw new ArgumentNullException ("hostName"); @@ -140,11 +143,15 @@ namespace System.Net { GetHostByNameCallback c = new GetHostByNameCallback (GetHostByName); return c.BeginInvoke (hostName, requestCallback, stateObject); +#endif // FEATURE_NO_BSD_SOCKETS } [Obsolete ("Use BeginGetHostEntry instead")] public static IAsyncResult BeginResolve (string hostName, AsyncCallback requestCallback, object stateObject) { +#if FEATURE_NO_BSD_SOCKETS + throw new PlatformNotSupportedException ("System.Net.Dns:BeginResolve is not supported on this platform."); +#else if (hostName == null) throw new ArgumentNullException ("hostName"); @@ -155,6 +162,7 @@ namespace System.Net { ResolveCallback c = new ResolveCallback (Resolve); return c.BeginInvoke (hostName, requestCallback, stateObject); +#endif // FEATURE_NO_BSD_SOCKETS } public static IAsyncResult BeginGetHostAddresses (string hostNameOrAddress, AsyncCallback requestCallback, object state) @@ -178,6 +186,9 @@ namespace System.Net { public static IAsyncResult BeginGetHostEntry (string hostNameOrAddress, AsyncCallback requestCallback, object stateObject) { +#if FEATURE_NO_BSD_SOCKETS + throw new PlatformNotSupportedException ("System.Net.Dns:GetHostEntry is not supported on this platform."); +#else if (hostNameOrAddress == null) throw new ArgumentNullException ("hostName"); if (hostNameOrAddress == "0.0.0.0" || hostNameOrAddress == "::0") @@ -193,10 +204,14 @@ namespace System.Net { GetHostEntryNameCallback c = new GetHostEntryNameCallback (GetHostEntry); return c.BeginInvoke (hostNameOrAddress, requestCallback, stateObject); +#endif // FEATURE_NO_BSD_SOCKETS } public static IAsyncResult BeginGetHostEntry (IPAddress address, AsyncCallback requestCallback, object stateObject) { +#if FEATURE_NO_BSD_SOCKETS + throw new PlatformNotSupportedException ("System.Net.Dns:BeginGetHostEntry is not supported on this platform."); +#else if (address == null) throw new ArgumentNullException ("address"); @@ -207,6 +222,7 @@ namespace System.Net { GetHostEntryIPCallback c = new GetHostEntryIPCallback (GetHostEntry); return c.BeginInvoke (address, requestCallback, stateObject); +#endif // FEATURE_NO_BSD_SOCKETS } [Obsolete ("Use EndGetHostEntry instead")] @@ -409,6 +425,10 @@ namespace System.Net { [Obsolete ("Use GetHostEntry instead")] public static IPHostEntry GetHostByName (string hostName) { +#if FEATURE_NO_BSD_SOCKETS + if (!string.IsNullOrEmpty (hostName)) + throw new PlatformNotSupportedException ("System.Net.Dns:GetHostByName is not supported on this platform."); +#endif // FEATURE_NO_BSD_SOCKETS if (hostName == null) throw new ArgumentNullException ("hostName"); string h_name; @@ -436,6 +456,9 @@ namespace System.Net { [Obsolete ("Use GetHostEntry instead")] public static IPHostEntry Resolve(string hostName) { +#if FEATURE_NO_BSD_SOCKETS + throw new PlatformNotSupportedException ("System.Net.Dns:Resolve is not supported on this platform."); +#else if (hostName == null) throw new ArgumentNullException ("hostName"); @@ -450,6 +473,7 @@ namespace System.Net { ret = GetHostByName(hostName); return ret; +#endif // FEATURE_NO_BSD_SOCKETS } public static Task GetHostAddressesAsync (string hostNameOrAddress) diff --git a/mcs/class/System/System.Net/FtpRequestCreator.platformnotsupported.cs b/mcs/class/System/System.Net/FtpRequestCreator.platformnotsupported.cs new file mode 100644 index 00000000000..ae365c28158 --- /dev/null +++ b/mcs/class/System/System.Net/FtpRequestCreator.platformnotsupported.cs @@ -0,0 +1,39 @@ +// +// System.Net.FtpbRequestCreator.cs +// +// Authors: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace System.Net +{ + class FtpRequestCreator : IWebRequestCreate + { + internal const string EXCEPTION_MESSAGE = "System.Net.FtpRequestCreator is not supported on the current platform."; + public WebRequest Create (Uri uri) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net/FtpWebRequest.platformnotsupported.cs b/mcs/class/System/System.Net/FtpWebRequest.platformnotsupported.cs new file mode 100644 index 00000000000..2bb79d77c0b --- /dev/null +++ b/mcs/class/System/System.Net/FtpWebRequest.platformnotsupported.cs @@ -0,0 +1,182 @@ +// +// System.Net.FtpWebRequest.cs +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.IO; +using System.Security.Cryptography.X509Certificates; + +namespace System.Net +{ + public sealed class FtpWebRequest : WebRequest + { + const string EXCEPTION_MESSAGE = "System.Net.FtpWebRequest is not supported on the current platform."; + + FtpWebRequest () + { + } + + public X509CertificateCollection ClientCertificates { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override string ConnectionGroupName { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override string ContentType { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override long ContentLength { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public long ContentOffset { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override ICredentials Credentials { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + +#if !MOBILE + public static new RequestCachePolicy DefaultCachePolicy { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } +#endif + + public bool EnableSsl { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override WebHeaderCollection Headers { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool KeepAlive { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override string Method { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override bool PreAuthenticate { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override IWebProxy Proxy { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int ReadWriteTimeout { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string RenameTo { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override Uri RequestUri { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public ServicePoint ServicePoint { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool UsePassive { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override bool UseDefaultCredentials { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool UseBinary { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override int Timeout { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override void Abort () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override WebResponse EndGetResponse (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override WebResponse GetResponse () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Stream EndGetRequestStream (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Stream GetRequestStream () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net/FtpWebResponse.platformnotsupported.cs b/mcs/class/System/System.Net/FtpWebResponse.platformnotsupported.cs new file mode 100644 index 00000000000..cd4fa71cee8 --- /dev/null +++ b/mcs/class/System/System.Net/FtpWebResponse.platformnotsupported.cs @@ -0,0 +1,91 @@ +// +// System.Net.FtpWebResponse.cs +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.IO; + +namespace System.Net +{ + public class FtpWebResponse : WebResponse + { + const string EXCEPTION_MESSAGE = "System.Net.FtpWebResponse is not supported on the current platform."; + + FtpWebResponse () + { + } + + public override long ContentLength { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override WebHeaderCollection Headers { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override Uri ResponseUri { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public DateTime LastModified { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string BannerMessage { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string WelcomeMessage { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string ExitMessage { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public FtpStatusCode StatusCode { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override bool SupportsHeaders { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string StatusDescription { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override void Close () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Stream GetResponseStream () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net/HttpListener.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListener.platformnotsupported.cs new file mode 100644 index 00000000000..b37b9d30bfb --- /dev/null +++ b/mcs/class/System/System.Net/HttpListener.platformnotsupported.cs @@ -0,0 +1,128 @@ +// +// System.Net.HttpListener +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Threading.Tasks; + +namespace System.Net { + public sealed class HttpListener : IDisposable + { + internal const string EXCEPTION_MESSAGE = "System.Net.HttpListener is not supported on the current platform."; + + public HttpListener () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal HttpListener (System.Security.Cryptography.X509Certificates.X509Certificate certificate, Mono.Net.Security.IMonoTlsProvider tlsProvider, Mono.Security.Interface.MonoTlsSettings tlsSettings) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public AuthenticationSchemes AuthenticationSchemes { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public AuthenticationSchemeSelector AuthenticationSchemeSelectorDelegate { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool IgnoreWriteExceptions { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool IsListening { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public static bool IsSupported { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public HttpListenerPrefixCollection Prefixes { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string Realm { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool UnsafeConnectionNtlmAuthentication { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public void Abort () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Close () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IAsyncResult BeginGetContext (AsyncCallback callback, Object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public HttpListenerContext EndGetContext (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public HttpListenerContext GetContext () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Start () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Stop () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + void IDisposable.Dispose () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task GetContextAsync () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs new file mode 100644 index 00000000000..4c729de26c4 --- /dev/null +++ b/mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs @@ -0,0 +1,68 @@ +// +// System.Net.HttpListenerContext +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Security.Principal; +using System.Threading.Tasks; +using System.Net.WebSockets; + +namespace System.Net { + public sealed class HttpListenerContext { + const string EXCEPTION_MESSAGE = "System.Net.HttpListenerContext is not supported on the current platform."; + + HttpListenerContext () + { + } + + public HttpListenerRequest Request { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public HttpListenerResponse Response { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public IPrincipal User { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Task AcceptWebSocketAsync (string subProtocol) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Task AcceptWebSocketAsync (string subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval, ArraySegment internalBuffer) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net/HttpListenerPrefixCollection.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListenerPrefixCollection.platformnotsupported.cs new file mode 100644 index 00000000000..e3566c2d756 --- /dev/null +++ b/mcs/class/System/System.Net/HttpListenerPrefixCollection.platformnotsupported.cs @@ -0,0 +1,93 @@ +// +// System.Net.HttpListenerPrefixCollection.cs +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Collections; +using System.Collections.Generic; + +namespace System.Net { + public class HttpListenerPrefixCollection : ICollection, IEnumerable, IEnumerable + { + const string EXCEPTION_MESSAGE = "System.Net.HttpListenerPrefixCollection is not supported on the current platform."; + + HttpListenerPrefixCollection () + { + } + + public int Count { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool IsReadOnly { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool IsSynchronized { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public void Add (string uriPrefix) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Clear () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public bool Contains (string uriPrefix) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void CopyTo (string [] array, int offset) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void CopyTo (Array array, int offset) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public IEnumerator GetEnumerator () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + IEnumerator IEnumerable.GetEnumerator () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public bool Remove (string uriPrefix) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net/HttpListenerRequest.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListenerRequest.platformnotsupported.cs new file mode 100644 index 00000000000..32560d96e21 --- /dev/null +++ b/mcs/class/System/System.Net/HttpListenerRequest.platformnotsupported.cs @@ -0,0 +1,180 @@ +// +// System.Net.HttpListenerRequest +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Collections.Specialized; +using System.IO; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace System.Net { + public sealed class HttpListenerRequest + { + const string EXCEPTION_MESSAGE = "System.Net.HttpListenerRequest is not supported on the current platform."; + + HttpListenerRequest () + { + } + + public string [] AcceptTypes { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int ClientCertificateError { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Encoding ContentEncoding { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public long ContentLength64 { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string ContentType { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public CookieCollection Cookies { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool HasEntityBody { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public NameValueCollection Headers { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string HttpMethod { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Stream InputStream { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool IsAuthenticated { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool IsLocal { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool IsSecureConnection { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool KeepAlive { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public IPEndPoint LocalEndPoint { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Version ProtocolVersion { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public NameValueCollection QueryString { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string RawUrl { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public IPEndPoint RemoteEndPoint { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Guid RequestTraceIdentifier { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Uri Url { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Uri UrlReferrer { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string UserAgent { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string UserHostAddress { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string UserHostName { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string [] UserLanguages { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public IAsyncResult BeginGetClientCertificate (AsyncCallback requestCallback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public X509Certificate2 EndGetClientCertificate (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public X509Certificate2 GetClientCertificate () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public string ServiceName { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public TransportContext TransportContext { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool IsWebSocketRequest { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Task GetClientCertificateAsync () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net/HttpListenerResponse.cs b/mcs/class/System/System.Net/HttpListenerResponse.cs index 15ec5bb59db..73aa6396b53 100644 --- a/mcs/class/System/System.Net/HttpListenerResponse.cs +++ b/mcs/class/System/System.Net/HttpListenerResponse.cs @@ -517,64 +517,6 @@ namespace System.Net { cookies.Add (cookie); } } - - // do not inline into HttpListenerResponse as this recursively brings everything that's - // reachable by IDisposable.Dispose (and that's quite a lot in this case). - static class HttpListenerResponseHelper { - - internal static string GetStatusDescription (int code) - { - switch (code){ - case 100: return "Continue"; - case 101: return "Switching Protocols"; - case 102: return "Processing"; - case 200: return "OK"; - case 201: return "Created"; - case 202: return "Accepted"; - case 203: return "Non-Authoritative Information"; - case 204: return "No Content"; - case 205: return "Reset Content"; - case 206: return "Partial Content"; - case 207: return "Multi-Status"; - case 300: return "Multiple Choices"; - case 301: return "Moved Permanently"; - case 302: return "Found"; - case 303: return "See Other"; - case 304: return "Not Modified"; - case 305: return "Use Proxy"; - case 307: return "Temporary Redirect"; - case 400: return "Bad Request"; - case 401: return "Unauthorized"; - case 402: return "Payment Required"; - case 403: return "Forbidden"; - case 404: return "Not Found"; - case 405: return "Method Not Allowed"; - case 406: return "Not Acceptable"; - case 407: return "Proxy Authentication Required"; - case 408: return "Request Timeout"; - case 409: return "Conflict"; - case 410: return "Gone"; - case 411: return "Length Required"; - case 412: return "Precondition Failed"; - case 413: return "Request Entity Too Large"; - case 414: return "Request-Uri Too Long"; - case 415: return "Unsupported Media Type"; - case 416: return "Requested Range Not Satisfiable"; - case 417: return "Expectation Failed"; - case 422: return "Unprocessable Entity"; - case 423: return "Locked"; - case 424: return "Failed Dependency"; - case 500: return "Internal Server Error"; - case 501: return "Not Implemented"; - case 502: return "Bad Gateway"; - case 503: return "Service Unavailable"; - case 504: return "Gateway Timeout"; - case 505: return "Http Version Not Supported"; - case 507: return "Insufficient Storage"; - } - return ""; - } - } } #endif diff --git a/mcs/class/System/System.Net/HttpListenerResponse.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListenerResponse.platformnotsupported.cs new file mode 100644 index 00000000000..97661d63983 --- /dev/null +++ b/mcs/class/System/System.Net/HttpListenerResponse.platformnotsupported.cs @@ -0,0 +1,150 @@ +// +// System.Net.HttpListenerResponse +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.IO; +using System.Text; + +namespace System.Net { + public sealed class HttpListenerResponse : IDisposable + { + const string EXCEPTION_MESSAGE = "System.Net.HttpListenerResponse is not supported on the current platform."; + + HttpListenerResponse () + { + } + + public Encoding ContentEncoding { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public long ContentLength64 { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string ContentType { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public CookieCollection Cookies { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public WebHeaderCollection Headers { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool KeepAlive { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Stream OutputStream { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Version ProtocolVersion { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string RedirectLocation { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool SendChunked { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int StatusCode { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string StatusDescription { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + void IDisposable.Dispose () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Abort () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AddHeader (string name, string value) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AppendCookie (Cookie cookie) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AppendHeader (string name, string value) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Close () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Close (byte [] responseEntity, bool willBlock) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void CopyFrom (HttpListenerResponse templateResponse) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void Redirect (string url) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void SetCookie (Cookie cookie) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.Net/HttpListenerResponseHelper.cs b/mcs/class/System/System.Net/HttpListenerResponseHelper.cs new file mode 100644 index 00000000000..7fc3c11bee6 --- /dev/null +++ b/mcs/class/System/System.Net/HttpListenerResponseHelper.cs @@ -0,0 +1,88 @@ +// +// System.Net.HttpListenerResponseHelper +// +// Author: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// +// Copyright (c) 2005 Novell, Inc. (http://www.novell.com) +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace System.Net { + // do not inline into HttpListenerResponse as this recursively brings everything that's + // reachable by IDisposable.Dispose (and that's quite a lot in this case). + static class HttpListenerResponseHelper { + + internal static string GetStatusDescription (int code) + { + switch (code){ + case 100: return "Continue"; + case 101: return "Switching Protocols"; + case 102: return "Processing"; + case 200: return "OK"; + case 201: return "Created"; + case 202: return "Accepted"; + case 203: return "Non-Authoritative Information"; + case 204: return "No Content"; + case 205: return "Reset Content"; + case 206: return "Partial Content"; + case 207: return "Multi-Status"; + case 300: return "Multiple Choices"; + case 301: return "Moved Permanently"; + case 302: return "Found"; + case 303: return "See Other"; + case 304: return "Not Modified"; + case 305: return "Use Proxy"; + case 307: return "Temporary Redirect"; + case 400: return "Bad Request"; + case 401: return "Unauthorized"; + case 402: return "Payment Required"; + case 403: return "Forbidden"; + case 404: return "Not Found"; + case 405: return "Method Not Allowed"; + case 406: return "Not Acceptable"; + case 407: return "Proxy Authentication Required"; + case 408: return "Request Timeout"; + case 409: return "Conflict"; + case 410: return "Gone"; + case 411: return "Length Required"; + case 412: return "Precondition Failed"; + case 413: return "Request Entity Too Large"; + case 414: return "Request-Uri Too Long"; + case 415: return "Unsupported Media Type"; + case 416: return "Requested Range Not Satisfiable"; + case 417: return "Expectation Failed"; + case 422: return "Unprocessable Entity"; + case 423: return "Locked"; + case 424: return "Failed Dependency"; + case 500: return "Internal Server Error"; + case 501: return "Not Implemented"; + case 502: return "Bad Gateway"; + case 503: return "Service Unavailable"; + case 504: return "Gateway Timeout"; + case 505: return "Http Version Not Supported"; + case 507: return "Insufficient Storage"; + } + return ""; + } + } +} diff --git a/mcs/class/System/System.Net/HttpWebRequest.platformnotsupported.cs b/mcs/class/System/System.Net/HttpWebRequest.platformnotsupported.cs new file mode 100644 index 00000000000..5fc016498d2 --- /dev/null +++ b/mcs/class/System/System.Net/HttpWebRequest.platformnotsupported.cs @@ -0,0 +1,460 @@ +// +// System.Net.HttpWebRequest +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.IO; +using System.Net.Security; +using System.Runtime.Serialization; +using System.Security.Cryptography.X509Certificates; + +namespace System.Net +{ + [Serializable] + public class HttpWebRequest : WebRequest, ISerializable + { + internal const string EXCEPTION_MESSAGE = "System.Net.HttpWebRequest is not supported on the current platform."; + + internal WebConnection WebConnection { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + +#if MOBILE + public +#else + internal +#endif + HttpWebRequest (Uri uri) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal HttpWebRequest (Uri uri, object /* IMonoTlsProvider */ tlsProvider, object /* MonoTlsSettings */ settings = null) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public string Accept { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Uri Address { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool AllowAutoRedirect { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool AllowWriteStreamBuffering { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual bool AllowReadStreamBuffering { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public DecompressionMethods AutomaticDecompression { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal bool InternalAllowBuffering { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal Mono.Net.Security.IMonoTlsProvider TlsProvider { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal Mono.Security.Interface.MonoTlsSettings TlsSettings { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public X509CertificateCollection ClientCertificates { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string Connection { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override string ConnectionGroupName { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override long ContentLength { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal long InternalContentLength { + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override string ContentType { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public HttpContinueDelegate ContinueDelegate { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual CookieContainer CookieContainer { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override ICredentials Credentials { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public DateTime Date { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + +#if !MOBILE + public static new RequestCachePolicy DefaultCachePolicy { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } +#endif + + public static int DefaultMaximumErrorResponseLength { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string Expect { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual bool HaveResponse { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override WebHeaderCollection Headers { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string Host { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public DateTime IfModifiedSince { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool KeepAlive { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int MaximumAutomaticRedirections { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int MaximumResponseHeadersLength { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public static int DefaultMaximumResponseHeadersLength { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int ReadWriteTimeout { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public int ContinueTimeout { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string MediaType { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override string Method { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool Pipelined { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override bool PreAuthenticate { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Version ProtocolVersion { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override IWebProxy Proxy { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string Referer { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override Uri RequestUri { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool SendChunked { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public ServicePoint ServicePoint { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal ServicePoint ServicePointNoLock { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual bool SupportsCookieContainer { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override int Timeout { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string TransferEncoding { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override bool UseDefaultCredentials { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string UserAgent { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public bool UnsafeAuthenticatedConnectionSharing { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal bool ExpectContinue { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal ServerCertValidationCallback ServerCertValidationCallback { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal Uri AuthUri { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public RemoteCertificateValidationCallback ServerCertificateValidationCallback { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public void AddRange (int range) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AddRange (int from, int to) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AddRange (string rangeSpecifier, int range) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AddRange (string rangeSpecifier, int from, int to) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AddRange (long range) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AddRange (long from, long to) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AddRange (string rangeSpecifier, long range) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public void AddRange (string rangeSpecifier, long from, long to) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Stream EndGetRequestStream (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Stream GetRequestStream() + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override WebResponse EndGetResponse (IAsyncResult asyncResult) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext transportContext) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override WebResponse GetResponse() + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal bool FinishedReading { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal bool Aborted { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override void Abort () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal void DoContinueDelegate (int statusCode, WebHeaderCollection headers) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal void SetWriteStreamError (WebExceptionStatus status, Exception exc) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal byte[] GetRequestHeaders () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal void SetWriteStream (WebConnectionStream stream) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal void SetResponseData (WebConnectionData data) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal void SetResponseError (WebExceptionStatus status, Exception e, string where) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal bool ReuseConnection { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + internal WebConnection StoredConnection { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + } +} diff --git a/mcs/class/System/System.Net/HttpWebResponse.platformnotsupported.cs b/mcs/class/System/System.Net/HttpWebResponse.platformnotsupported.cs new file mode 100644 index 00000000000..300d5d4f607 --- /dev/null +++ b/mcs/class/System/System.Net/HttpWebResponse.platformnotsupported.cs @@ -0,0 +1,147 @@ +// +// System.Net.HttpWebResponse +// +// Author: +// Rolf Bjarne Kvinge +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.IO; +using System.Runtime.Serialization; + +namespace System.Net +{ + [Serializable] + public class HttpWebResponse : WebResponse, ISerializable, IDisposable + { + const string EXCEPTION_MESSAGE = "System.Net.HttpWebResponse is not supported on the current platform."; + + [Obsolete ("Serialization is obsoleted for this type", false)] + protected HttpWebResponse (SerializationInfo serializationInfo, StreamingContext streamingContext) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public string CharacterSet { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string ContentEncoding { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override long ContentLength { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override string ContentType { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual CookieCollection Cookies { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override WebHeaderCollection Headers { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + [MonoTODO] + public override bool IsMutuallyAuthenticated { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public DateTime LastModified { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual string Method { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public Version ProtocolVersion { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override Uri ResponseUri { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string Server { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual HttpStatusCode StatusCode { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public virtual string StatusDescription { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public override bool SupportsHeaders { + get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } + } + + public string GetResponseHeader (string headerName) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + internal void ReadAll () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override Stream GetResponseStream () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + public override void Close () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + void IDisposable.Dispose () + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + + protected override void Dispose (bool disposing) + { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); + } + } +} diff --git a/mcs/class/System/System.dll.sources b/mcs/class/System/System.dll.sources index 4b4e6e3ef15..26e65f5a135 100644 --- a/mcs/class/System/System.dll.sources +++ b/mcs/class/System/System.dll.sources @@ -269,6 +269,7 @@ System.Net/HttpListener.cs System.Net/HttpListenerPrefixCollection.cs System.Net/HttpListenerRequest.cs System.Net/HttpListenerResponse.cs +System.Net/HttpListenerResponseHelper.cs System.Net/HttpListenerTimeoutManager.cs System.Net/HttpRequestCreator.cs System.Net/HttpStreamAsyncResult.cs diff --git a/mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs b/mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs index 909beb4988c..8c163f77b02 100644 --- a/mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs +++ b/mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs @@ -16,16 +16,15 @@ using System.Threading; namespace MonoTests.System.Net.Mail { [TestFixture] - [Category ("RequiresBSDSockets")] public class SmtpClientTest { - SmtpClient smtp; + SmtpClient _smtp; + SmtpClient smtp { get { return _smtp ?? (_smtp = new SmtpClient ()); } } string tempFolder; [SetUp] public void GetReady () { - smtp = new SmtpClient (); tempFolder = Path.Combine (Path.GetTempPath (), this.GetType ().FullName); if (Directory.Exists (tempFolder)) Directory.Delete (tempFolder, true); @@ -40,12 +39,18 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Credentials_Default () { Assert.IsNull (smtp.Credentials); } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DeliveryMethod () { Assert.AreEqual (SmtpDeliveryMethod.Network, smtp.DeliveryMethod, "#1"); @@ -61,6 +66,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void EnableSsl () { Assert.IsFalse (smtp.EnableSsl, "#1"); @@ -71,6 +79,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Host () { smtp.Host = "127.0.0.1"; @@ -87,6 +98,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Host_Value_Null () { try { @@ -101,6 +115,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Host_Value_Empty () { try { @@ -116,6 +133,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PickupDirectoryLocation () { Assert.IsNull (smtp.PickupDirectoryLocation, "#1"); @@ -132,6 +152,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Port () { Assert.AreEqual (25, smtp.Port, "#1"); @@ -142,6 +165,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Port_Value_Invalid () { // zero @@ -168,6 +194,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Message_Null () { try { @@ -182,6 +211,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Network_Host_Null () { try { @@ -197,6 +229,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_Network_Host_Whitespace () { smtp.Host = " \r\n "; @@ -213,6 +248,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_SpecifiedPickupDirectory () { smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; @@ -226,6 +264,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_DirectoryNotFound () { Directory.Delete (tempFolder); @@ -253,6 +294,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_Empty () { smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; @@ -272,6 +316,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_IllegalChars () { smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; @@ -297,6 +344,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_NotAbsolute () { smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; @@ -316,6 +366,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Send_SpecifiedPickupDirectory_PickupDirectoryLocation_Null () { smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; @@ -334,6 +387,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Timeout () { Assert.AreEqual (100000, smtp.Timeout, "#1"); @@ -344,19 +400,29 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentOutOfRangeException))] +#endif public void Timeout_Value_Negative () { smtp.Timeout = -1; } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UseDefaultCredentials_Default () { Assert.IsFalse (smtp.UseDefaultCredentials); } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Deliver () { var server = new SmtpServer (); @@ -373,6 +439,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Deliver_Envelope () { var server = new SmtpServer (); @@ -391,6 +460,9 @@ namespace MonoTests.System.Net.Mail } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Deliver_Async () { // SmtpClient uses BackgroundWorker and listens for the RunWorkerCompleted diff --git a/mcs/class/System/Test/System.Net.Security/SslStreamTest.cs b/mcs/class/System/Test/System.Net.Security/SslStreamTest.cs index e5c70feab2c..e3542c34f37 100644 --- a/mcs/class/System/Test/System.Net.Security/SslStreamTest.cs +++ b/mcs/class/System/Test/System.Net.Security/SslStreamTest.cs @@ -45,7 +45,6 @@ namespace MonoTests.System.Net.Security { [TestFixture] -[Category ("RequiresBSDSockets")] public class SslStreamTest { byte[] m_serverCertRaw = { 48, 130, 5, 165, 2, 1, 3, 48, 130, 5, 95, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 130, 5, 80, 4, 130, 5, 76, 48, 130, 5, 72, 48, 130, 2, 87, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 6, 160, 130, 2, 72, 48, 130, 2, 68, 2, 1, 0, 48, 130, 2, 61, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 48, 28, 6, 10, 42, 134, 72, 134, 247, 13, 1, 12, 1, 3, 48, 14, 4, 8, 211, 176, 234, 3, 252, 26, 32, 15, 2, 2, 7, 208, 128, 130, 2, 16, 183, 149, 35, 180, 127, 95, 163, 122, 138, 244, 29, 177, 220, 173, 46, 73, 208, 217, 211, 190, 164, 183, 21, 110, 33, 122, 98, 163, 251, 16, 23, 106, 154, 14, 52, 177, 3, 12, 248, 226, 48, 123, 211, 6, 216, 6, 192, 175, 203, 142, 141, 143, 252, 178, 7, 162, 81, 232, 159, 42, 56, 177, 191, 53, 7, 146, 189, 236, 75, 140, 210, 143, 11, 103, 64, 58, 10, 73, 123, 39, 97, 119, 166, 114, 123, 65, 68, 214, 42, 17, 156, 122, 8, 58, 184, 134, 255, 48, 64, 20, 229, 247, 196, 12, 130, 56, 176, 69, 179, 254, 216, 45, 25, 244, 240, 116, 88, 137, 66, 13, 18, 202, 199, 59, 200, 245, 19, 175, 232, 217, 211, 12, 191, 222, 26, 162, 253, 73, 201, 48, 61, 3, 248, 117, 16, 71, 233, 183, 90, 110, 91, 116, 56, 133, 223, 148, 19, 78, 140, 123, 159, 203, 78, 15, 172, 39, 190, 39, 71, 180, 155, 48, 156, 116, 212, 52, 1, 231, 201, 196, 73, 87, 68, 104, 208, 40, 104, 32, 218, 235, 245, 84, 136, 168, 51, 9, 93, 126, 46, 80, 180, 240, 144, 79, 88, 87, 159, 24, 108, 186, 9, 20, 48, 100, 148, 250, 4, 163, 115, 131, 44, 13, 38, 222, 117, 196, 196, 128, 114, 149, 97, 93, 37, 191, 3, 192, 231, 88, 80, 218, 147, 8, 192, 165, 27, 206, 56, 42, 157, 230, 223, 130, 253, 169, 182, 245, 192, 181, 18, 212, 133, 168, 73, 92, 66, 197, 117, 245, 107, 127, 23, 146, 249, 41, 66, 219, 210, 207, 221, 205, 205, 15, 110, 92, 12, 207, 76, 239, 4, 13, 129, 127, 170, 205, 253, 148, 208, 24, 129, 24, 210, 220, 85, 45, 179, 137, 66, 134, 142, 22, 112, 48, 160, 236, 232, 38, 83, 101, 55, 51, 18, 110, 99, 69, 41, 173, 107, 233, 11, 199, 23, 61, 135, 222, 94, 74, 29, 219, 80, 128, 167, 186, 254, 235, 42, 96, 134, 5, 13, 90, 59, 231, 137, 195, 207, 28, 165, 12, 218, 5, 72, 102, 61, 135, 198, 73, 250, 97, 89, 214, 179, 244, 194, 23, 142, 157, 4, 243, 90, 69, 54, 10, 139, 76, 95, 40, 225, 219, 59, 15, 54, 182, 206, 142, 228, 248, 79, 156, 129, 246, 63, 6, 6, 236, 44, 67, 116, 213, 170, 47, 193, 186, 139, 25, 80, 166, 57, 99, 231, 156, 191, 117, 65, 76, 7, 243, 244, 127, 225, 210, 190, 164, 141, 46, 36, 99, 111, 203, 133, 127, 80, 28, 61, 160, 36, 132, 182, 16, 41, 39, 185, 232, 123, 32, 57, 189, 100, 152, 38, 205, 5, 189, 240, 65, 3, 191, 73, 85, 12, 209, 180, 1, 194, 70, 124, 57, 71, 48, 230, 235, 122, 175, 157, 35, 233, 83, 40, 20, 169, 224, 14, 11, 216, 48, 194, 105, 25, 187, 210, 182, 6, 184, 73, 95, 85, 210, 227, 113, 58, 10, 186, 175, 254, 25, 102, 39, 3, 2, 200, 194, 197, 200, 224, 77, 164, 8, 36, 114, 48, 130, 2, 233, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 130, 2, 218, 4, 130, 2, 214, 48, 130, 2, 210, 48, 130, 2, 206, 6, 11, 42, 134, 72, 134, 247, 13, 1, 12, 10, 1, 2, 160, 130, 2, 166, 48, 130, 2, 162, 48, 28, 6, 10, 42, 134, 72, 134, 247, 13, 1, 12, 1, 3, 48, 14, 4, 8, 178, 13, 52, 135, 85, 49, 79, 105, 2, 2, 7, 208, 4, 130, 2, 128, 21, 84, 227, 109, 230, 144, 140, 170, 117, 250, 179, 207, 129, 100, 126, 126, 29, 231, 94, 140, 45, 26, 168, 45, 240, 4, 170, 73, 98, 115, 109, 96, 177, 206, 6, 80, 170, 22, 237, 144, 58, 95, 59, 26, 85, 135, 178, 69, 184, 44, 122, 81, 213, 135, 149, 198, 246, 83, 68, 129, 2, 186, 118, 33, 44, 214, 227, 240, 220, 51, 175, 220, 220, 180, 113, 216, 101, 138, 81, 54, 38, 0, 216, 30, 29, 187, 213, 230, 12, 181, 130, 21, 241, 98, 120, 41, 150, 176, 69, 37, 169, 249, 123, 212, 254, 135, 154, 214, 127, 39, 105, 149, 180, 218, 41, 207, 75, 70, 105, 169, 185, 169, 132, 173, 188, 82, 251, 71, 234, 136, 5, 254, 110, 223, 34, 4, 145, 7, 19, 51, 123, 140, 75, 226, 0, 21, 220, 228, 223, 218, 8, 169, 210, 194, 139, 93, 218, 55, 40, 174, 50, 238, 38, 166, 222, 103, 0, 209, 88, 131, 51, 222, 154, 217, 18, 172, 73, 17, 133, 54, 173, 208, 118, 104, 167, 113, 153, 223, 251, 154, 120, 176, 18, 127, 51, 206, 164, 77, 86, 9, 82, 212, 86, 162, 206, 230, 79, 217, 178, 42, 217, 162, 152, 188, 217, 59, 212, 117, 200, 135, 75, 74, 43, 1, 42, 79, 180, 164, 250, 122, 103, 103, 157, 11, 14, 33, 48, 8, 108, 155, 46, 124, 223, 204, 169, 124, 104, 11, 246, 213, 226, 16, 125, 17, 228, 15, 178, 141, 79, 78, 115, 76, 131, 122, 166, 124, 154, 1, 174, 178, 176, 213, 208, 188, 71, 118, 220, 168, 64, 218, 176, 134, 38, 229, 14, 109, 162, 125, 16, 57, 249, 201, 180, 17, 182, 143, 184, 12, 248, 113, 65, 70, 109, 79, 249, 34, 170, 35, 228, 219, 121, 202, 228, 121, 127, 255, 22, 173, 202, 171, 33, 232, 4, 240, 142, 216, 80, 56, 177, 83, 93, 123, 217, 213, 157, 99, 34, 194, 61, 228, 239, 194, 20, 27, 9, 53, 132, 79, 19, 97, 107, 31, 51, 39, 176, 223, 90, 88, 67, 138, 194, 169, 176, 144, 202, 119, 146, 74, 27, 118, 63, 129, 230, 101, 104, 75, 116, 49, 223, 254, 225, 70, 206, 183, 11, 134, 148, 10, 55, 57, 50, 178, 144, 164, 139, 233, 169, 109, 186, 211, 95, 123, 75, 111, 192, 187, 127, 240, 45, 226, 194, 240, 128, 10, 79, 178, 192, 66, 21, 197, 24, 171, 141, 255, 185, 230, 84, 206, 151, 9, 93, 115, 162, 12, 115, 129, 218, 103, 219, 183, 142, 123, 3, 110, 139, 208, 4, 146, 76, 99, 246, 240, 32, 169, 148, 16, 146, 172, 230, 36, 56, 145, 23, 94, 209, 92, 38, 244, 127, 70, 121, 253, 66, 55, 36, 140, 98, 105, 233, 112, 24, 23, 230, 112, 62, 244, 12, 48, 30, 51, 0, 18, 244, 139, 66, 245, 234, 203, 195, 52, 119, 255, 84, 82, 204, 100, 176, 167, 24, 224, 8, 127, 214, 148, 115, 242, 56, 190, 72, 221, 68, 252, 36, 74, 254, 57, 52, 96, 20, 173, 32, 236, 87, 15, 16, 76, 9, 48, 3, 61, 2, 137, 137, 9, 68, 213, 99, 163, 63, 201, 83, 241, 98, 7, 117, 108, 4, 123, 170, 18, 10, 19, 198, 31, 170, 15, 247, 216, 145, 172, 239, 137, 181, 80, 160, 24, 11, 35, 131, 58, 218, 22, 250, 215, 52, 160, 246, 197, 183, 92, 137, 0, 245, 63, 49, 183, 246, 195, 58, 63, 4, 75, 10, 92, 131, 181, 59, 78, 247, 44, 150, 49, 49, 107, 211, 62, 71, 62, 222, 159, 161, 118, 236, 55, 219, 49, 0, 3, 82, 236, 96, 20, 83, 39, 245, 208, 240, 245, 174, 218, 49, 21, 48, 19, 6, 9, 42, 134, 72, 134, 247, 13, 1, 9, 21, 49, 6, 4, 4, 1, 0, 0, 0, 48, 61, 48, 33, 48, 9, 6, 5, 43, 14, 3, 2, 26, 5, 0, 4, 20, 30, 154, 48, 126, 198, 239, 114, 62, 12, 58, 129, 172, 67, 156, 76, 214, 62, 205, 89, 28, 4, 20, 135, 177, 105, 83, 79, 93, 181, 149, 169, 49, 112, 201, 70, 212, 153, 79, 198, 163, 137, 90, 2, 2, 7, 208 }; @@ -60,6 +59,9 @@ public class SslStreamTest { } [Test] //bug https://bugzilla.novell.com/show_bug.cgi?id=457120 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AuthenticateClientAndServer_ClientSendsNoData () { AuthenticateClientAndServer (true, true); diff --git a/mcs/class/System/Test/System.Net.Sockets/NetworkStreamTest.cs b/mcs/class/System/Test/System.Net.Sockets/NetworkStreamTest.cs index e51f2d9b7d5..0af239d238c 100644 --- a/mcs/class/System/Test/System.Net.Sockets/NetworkStreamTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/NetworkStreamTest.cs @@ -16,12 +16,16 @@ using NUnit.Framework; namespace MonoTests.System.Net.Sockets { [TestFixture] - [Category ("RequiresBSDSockets")] public class NetworkStreamTest { [Test] // See bug #371923 + +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException(typeof(IOException))] +#endif public void NetworkStreamConnection () { IPEndPoint ipe = new IPEndPoint(Dns.GetHostEntry ("www.google.com").AddressList [0], 80); @@ -31,6 +35,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReadTimeout () { Socket sock = new Socket (AddressFamily.InterNetwork, diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs index 28bc6bb8174..cc2d8249fd3 100644 --- a/mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs @@ -6,10 +6,12 @@ using NUnit.Framework; namespace MonoTests.System.Net.Sockets { [TestFixture] - [Category ("RequiresBSDSockets")] public class SocketAcceptAsyncTest { [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AcceptAsyncShouldUseAcceptSocketFromEventArgs() { var readyEvent = new ManualResetEvent(false); @@ -19,27 +21,41 @@ namespace MonoTests.System.Net.Sockets var serverSocket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Socket acceptedSocket = null; - + Exception ex = null; ThreadPool.QueueUserWorkItem(_ => { - listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, 0)); - listenSocket.Listen(1); - - var asyncEventArgs = new SocketAsyncEventArgs {AcceptSocket = serverSocket}; - asyncEventArgs.Completed += (s, e) => - { - acceptedSocket = e.AcceptSocket; - mainEvent.Set(); - }; + SocketAsyncEventArgs asyncEventArgs; + try { + listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, 0)); + listenSocket.Listen(1); - readyEvent.Set(); + asyncEventArgs = new SocketAsyncEventArgs {AcceptSocket = serverSocket}; + asyncEventArgs.Completed += (s, e) => + { + acceptedSocket = e.AcceptSocket; + mainEvent.Set(); + }; - if (listenSocket.AcceptAsync(asyncEventArgs)) + } catch (Exception e) { + ex = e; return; - acceptedSocket = asyncEventArgs.AcceptSocket; - mainEvent.Set(); + } finally { + readyEvent.Set(); + } + + try { + if (listenSocket.AcceptAsync(asyncEventArgs)) + return; + acceptedSocket = asyncEventArgs.AcceptSocket; + } catch (Exception e) { + ex = e; + } finally { + mainEvent.Set(); + } }); Assert.IsTrue(readyEvent.WaitOne(1500)); + if (ex != null) + throw ex; var clientSocket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs index d286668707e..df31233d68f 100644 --- a/mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs @@ -8,7 +8,6 @@ using NUnit.Framework; namespace MonoTests.System.Net.Sockets { [TestFixture] - [Category ("RequiresBSDSockets")] public class SocketAsyncTest { Socket serverSocket; @@ -17,8 +16,7 @@ namespace MonoTests.System.Net.Sockets ManualResetEvent mainEvent; Exception error; - [TestFixtureSetUp] - public void SetUp () + void SetUp () { readyEvent = new ManualResetEvent (false); mainEvent = new ManualResetEvent (false); @@ -26,6 +24,9 @@ namespace MonoTests.System.Net.Sockets ThreadPool.QueueUserWorkItem (_ => DoWork ()); readyEvent.WaitOne (); + if (error != null) + throw error; + clientSocket = new Socket ( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); clientSocket.Connect (serverSocket.LocalEndPoint); @@ -43,18 +44,22 @@ namespace MonoTests.System.Net.Sockets void DoWork () { - serverSocket = new Socket ( - AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - serverSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0)); - serverSocket.Listen (1); - - var async = new SocketAsyncEventArgs (); - async.Completed += (s,e) => OnAccepted (e); - - readyEvent.Set (); - - if (!serverSocket.AcceptAsync (async)) - OnAccepted (async); + try { + serverSocket = new Socket ( + AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + serverSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0)); + serverSocket.Listen (1); + + var async = new SocketAsyncEventArgs (); + async.Completed += (s,e) => OnAccepted (e); + + if (!serverSocket.AcceptAsync (async)) + OnAccepted (async); + } catch (Exception e) { + error = e; + } finally { + readyEvent.Set (); + } } void OnAccepted (SocketAsyncEventArgs e) @@ -93,8 +98,12 @@ namespace MonoTests.System.Net.Sockets [Test] [Category("Test")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SendAsync () { + SetUp (); var buffer = new byte [] { 0x12, 0x34, 0x56, 0x78 }; var m = new ManualResetEvent (false); var e = new SocketAsyncEventArgs (); diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs index ac0f766f2a8..58c1c5c5a3c 100755 --- a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs @@ -28,7 +28,6 @@ using MonoTests.Helpers; namespace MonoTests.System.Net.Sockets { [TestFixture] - [Category ("RequiresBSDSockets")] public class SocketTest { // note: also used in SocketCas tests @@ -36,6 +35,9 @@ namespace MonoTests.System.Net.Sockets public const int BogusPort = 23483; [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectIPAddressAny () { IPEndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()); @@ -86,6 +88,9 @@ namespace MonoTests.System.Net.Sockets [Test] [Category ("InetAccess")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BogusEndConnect () { IPAddress ipOne = IPAddress.Parse (BogusAddress); @@ -156,6 +161,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AcceptBlockingStatus() { bool block; @@ -200,6 +208,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectFailAsync () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -222,6 +233,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SetSocketOptionBoolean () { IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ()); @@ -233,6 +247,9 @@ namespace MonoTests.System.Net.Sockets } } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestSelect1 () { Socket srv = CreateServer (NetworkHelpers.FindFreePort ()); @@ -370,7 +387,11 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void Disposed19 () { Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); @@ -381,7 +402,11 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void Disposed20 () { Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); @@ -392,7 +417,11 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void Disposed21 () { Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); @@ -403,7 +432,11 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void Disposed22 () { Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); @@ -424,6 +457,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetHashCodeTest () { Socket server = new Socket (AddressFamily.InterNetwork, @@ -459,6 +495,7 @@ namespace MonoTests.System.Net.Sockets } [Test] + [Category ("RequiresBSDSockets")] // This verifies particular error codes, which we don't care about when nothing's working anyway. public void SocketErrorTest () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -700,6 +737,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void IsBoundTcp () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -732,6 +772,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void IsBoundUdp () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1304,7 +1347,11 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof(InvalidOperationException))] +#endif public void BeginAcceptNotListening () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1319,6 +1366,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginAccept () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1386,6 +1436,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginAcceptData () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1450,6 +1503,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginAcceptSocketUdp () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1477,6 +1533,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginAcceptSocketBound () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1508,6 +1567,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginAcceptSocket () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1589,6 +1651,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginAcceptSocketAccClosed () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1638,6 +1703,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginConnectAddressPort () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1687,6 +1755,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginConnectAddressPortListen () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1781,6 +1852,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginConnectMultiple2 () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1853,6 +1927,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginConnectMultipleListen () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1917,6 +1994,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginConnectHostPortListen () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -1984,6 +2064,9 @@ namespace MonoTests.System.Net.Sockets [Test] [Category ("NotDotNet")] // "Needs XP or later" +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginDisconnect () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2080,6 +2163,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BindTwice () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2103,6 +2189,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Close () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2131,6 +2220,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectAddressPort () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2171,6 +2263,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectAddressPortListen () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2257,6 +2352,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectMultiple2 () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2314,6 +2412,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectMultipleListen () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2376,6 +2477,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectHostPortListen () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2414,7 +2518,11 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof(ObjectDisposedException))] +#endif public void ConnectHostPortClosed () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2428,6 +2536,9 @@ namespace MonoTests.System.Net.Sockets [Test] [Category ("NotDotNet")] // "Needs XP or later" +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Disconnect () { Socket sock = new Socket (AddressFamily.InterNetwork, @@ -2485,6 +2596,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveGeneric () { int i; @@ -2542,6 +2656,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SendGeneric () { int i; @@ -2700,6 +2817,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CloseWhileReceiving () { CWRSocket = new Socket (AddressFamily.InterNetwork, @@ -3069,6 +3189,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], ref EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom1_Buffer_Null () { Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, @@ -3110,6 +3233,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], ref EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom1_Socket_Closed () { Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, @@ -3130,6 +3256,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], SocketFlags, ref EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom2_Buffer_Null () { Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, @@ -3171,6 +3300,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], SocketFlags, ref EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom2_Socket_Closed () { Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, @@ -3191,6 +3323,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], Int32, SocketFlags, ref EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom3_Buffer_Null () { Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, @@ -3233,6 +3368,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], Int32, SocketFlags, ref EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom3_Size_OutOfRange () { Socket s; @@ -3274,6 +3412,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], Int32, SocketFlags, ref EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom3_Socket_Closed () { Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, @@ -3295,6 +3436,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom4_Buffer_Null () { Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, @@ -3314,6 +3458,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom4_Offset_OutOfRange () { Socket s; @@ -3377,6 +3524,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom4_Size_OutOfRange () { Socket s; @@ -3435,6 +3585,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // ReceiveFrom (Byte [], Int32, Int32, SocketFlags, ref EndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveFrom4_Socket_Closed () { Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, @@ -3457,6 +3610,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveRemoteClosed () { var port = NetworkHelpers.FindFreePort (); @@ -3484,6 +3640,9 @@ namespace MonoTests.System.Net.Sockets // // Test case for bug #471580 [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UdpDoubleBind () { using (Socket s = new Socket (AddressFamily.InterNetwork, @@ -3517,6 +3676,9 @@ namespace MonoTests.System.Net.Sockets // Test case for bug #31557 [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TcpDoubleBind () { using (Socket s = new Socket (AddressFamily.InterNetwork, @@ -3755,6 +3917,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SetSocketOption3_AddMembershipIPv4_IPv6MulticastOption () { IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250"); @@ -3777,6 +3942,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SetSocketOption3_AddMembershipIPv4_MulticastOption () { IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250"); @@ -3813,6 +3981,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SetSocketOption3_AddMembershipIPv6_IPv6MulticastOption () { if (!Socket.OSSupportsIPv6) @@ -3828,6 +3999,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SetSocketOption3_AddMembershipIPv6_MulticastOption () { if (!Socket.OSSupportsIPv6) @@ -3982,6 +4156,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SetSocketOption3_DropMembershipIPv4_IPv6MulticastOption () { IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250"); @@ -4006,6 +4183,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SetSocketOption3_DropMembershipIPv4_MulticastOption () { IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250"); @@ -4046,6 +4226,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SetSocketOption3_DropMembershipIPv6_IPv6MulticastOption () { if (!Socket.OSSupportsIPv6) @@ -4064,6 +4247,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // SetSocketOption (SocketOptionLevel, SocketOptionName, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SetSocketOption3_DropMembershipIPv6_MulticastOption () { if (!Socket.OSSupportsIPv6) @@ -4150,6 +4336,7 @@ namespace MonoTests.System.Net.Sockets } [Test] + [Category ("RequiresBSDSockets")] // on watchOS device this happens: System.Net.Sockets.SocketException : The requested address is not valid in this context. This situation is too complex to detect and throw a PlatformNotSupportedException, so just ignore it. public void SetSocketOption_MulticastInterfaceIndex_Any () { IPAddress ip = IPAddress.Parse ("239.255.255.250"); @@ -4162,6 +4349,7 @@ namespace MonoTests.System.Net.Sockets } [Test] + [Category ("RequiresBSDSockets")] // on watchOS device this happens: System.Net.Sockets.SocketException : The requested address is not valid in this context. This situation is too complex to detect and throw a PlatformNotSupportedException, so just ignore it. public void SetSocketOption_MulticastInterfaceIndex_Loopback () { IPAddress ip = IPAddress.Parse ("239.255.255.250"); @@ -4198,6 +4386,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Shutdown_NoConnect () { Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); @@ -4294,6 +4485,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SendAsyncFile () { Socket serverSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); @@ -4352,6 +4546,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectToIPV4EndPointUsingDualModelSocket () { /* * IPv6 DualMode sockets are defaults in Mono. Explicitly specify that @@ -4392,6 +4589,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginConnectToIPV4EndPointUsingDualModelSocket () { /* * IPv6 DualMode sockets are defaults in Mono. Explicitly specify that @@ -4435,6 +4635,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UdpMulticasTimeToLive () { /* see https://bugzilla.xamarin.com/show_bug.cgi?id=36941 */ diff --git a/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs b/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs index 4d3b8325048..5db3aadbc87 100644 --- a/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs @@ -21,7 +21,6 @@ namespace MonoTests.System.Net.Sockets /// Tests System.Net.Sockets.TcpClient /// [TestFixture] - [Category ("RequiresBSDSockets")] public class TcpClientTest { @@ -30,6 +29,9 @@ namespace MonoTests.System.Net.Sockets /// (from System.Net.Sockets) /// [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TcpClient() { // set up a listening Socket @@ -77,6 +79,9 @@ namespace MonoTests.System.Net.Sockets } [Test] // bug #81105 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CloseTest () { var port = NetworkHelpers.FindFreePort (); @@ -140,7 +145,11 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof(ArgumentNullException))] +#endif public void ConnectMultiNull () { TcpClient client = new TcpClient (); @@ -150,6 +159,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectMultiAny () { TcpClient client = new TcpClient (); @@ -168,6 +180,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectMultiRefused () { TcpClient client = new TcpClient (); diff --git a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs index 1e211cf5249..25e8854ed6a 100644 --- a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs @@ -20,10 +20,12 @@ using MonoTests.Helpers; namespace MonoTests.System.Net.Sockets { [TestFixture] - [Category ("RequiresBSDSockets")] public class TcpListenerTest { [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TcpListener () { var port = NetworkHelpers.FindFreePort (); @@ -75,6 +77,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CtorInt1 () { int nex = 0; @@ -87,21 +92,33 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentNullException))] +#endif public void CtorIPEndPoint () { new TcpListener (null); } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentNullException))] +#endif public void CtorIPAddressInt1 () { new TcpListener (null, 100000); } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentOutOfRangeException))] +#endif public void CtorIPAddressInt2 () { new TcpListener (IPAddress.Any, 100000); @@ -125,6 +142,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PreStartStatus () { MyListener listener = new MyListener (); @@ -152,6 +172,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PostStartStatus () { MyListener listener = new MyListener (); @@ -173,6 +196,9 @@ namespace MonoTests.System.Net.Sockets } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void StartListenMoreThan5 () { var port = NetworkHelpers.FindFreePort (); diff --git a/mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs b/mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs index 66b15308d1f..996da16f5cc 100644 --- a/mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs @@ -15,9 +15,11 @@ using NUnit.Framework; namespace MonoTests.System.Net.Sockets { [TestFixture] - [Category ("RequiresBSDSockets")] public class UdpClientTest { [Test] // .ctor () +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor1 () { MyUdpClient client; @@ -43,6 +45,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (AddressFamily) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor2 () { MyUdpClient client; @@ -88,6 +93,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (AddressFamily) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor2_Family_Invalid () { try { @@ -114,6 +122,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (Int32) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor3 () { Socket s; @@ -163,6 +174,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (Int32) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor3_Port_OutOfRange () { try { @@ -189,6 +203,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (IPEndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor4 () { Socket s; @@ -221,6 +238,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (IPEndPoint) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor4_LocalEP_Null () { try { @@ -235,6 +255,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (Int32, AddressFamily) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor5 () { Socket s; @@ -288,6 +311,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (Int32, AddressFamily) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor5_Family_Invalid () { try { @@ -318,6 +344,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (Int32, AddressFamily) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor5_Port_OutOfRange () { try { @@ -344,6 +373,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (String, Int32) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor6 () { Socket s; @@ -394,6 +426,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (String, Int32) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor6_HostName_Null () { try { @@ -408,6 +443,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // .ctor (String, Int32) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Constructor6_Port_OutOfRange () { try { @@ -434,6 +472,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UdpClientBroadcastTest () { UdpClient client = new UdpClient (); @@ -447,6 +488,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup1_IPv4 () { IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23"); @@ -457,6 +501,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup1_IPv6 () { if (!Socket.OSSupportsIPv6) @@ -470,6 +517,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup1_MulticastAddr_Null () { using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) { @@ -486,6 +536,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup1_Socket_Closed () { IPAddress mcast_addr = null; @@ -528,6 +581,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (In32, IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup2_IPv4 () { IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23"); @@ -550,6 +606,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (In32, IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup2_IPv6 () { if (!Socket.OSSupportsIPv6) @@ -563,6 +622,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (Int32, IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup2_MulticastAddr_Null () { using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) { @@ -579,6 +641,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (Int32, IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup2_Socket_Closed () { if (!Socket.OSSupportsIPv6) @@ -624,6 +689,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress, Int32) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup3_IPv4 () { IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23"); @@ -638,6 +706,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress, Int32) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup3_IPv6 () { if (!Socket.OSSupportsIPv6) @@ -655,6 +726,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress, Int32) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup3_MulticastAddr_Null () { using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) { @@ -671,6 +745,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress, Int32) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup3_Socket_Closed () { IPAddress mcast_addr = null; @@ -713,6 +790,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress, IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup4_IPv4 () { IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23"); @@ -724,6 +804,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress, IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup4_IPv6 () { if (!Socket.OSSupportsIPv6) @@ -750,6 +833,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress, IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup4_LocalAddress_Null () { IPAddress mcast_addr = IPAddress.Parse ("224.0.0.23"); @@ -768,6 +854,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress, IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup4_MulticastAddr_Null () { using (UdpClient client = new UdpClient (new IPEndPoint (IPAddress.Loopback, 1234))) { @@ -784,6 +873,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // JoinMulticastGroup (IPAddress, IPAddress) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroup4_Socket_Closed () { IPAddress mcast_addr = null; @@ -828,6 +920,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CloseInReceive () { UdpClient client = null; @@ -868,6 +963,9 @@ namespace MonoTests.System.Net.Sockets { // Test for bug 324033 [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void JoinMulticastGroupWithLocal () { UdpClient client = new UdpClient (9001); @@ -882,7 +980,11 @@ namespace MonoTests.System.Net.Sockets { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof(ArgumentNullException))] +#endif public void BeginSendNull () { UdpClient client = new UdpClient (); @@ -905,6 +1007,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginSend () { UdpClient client = new UdpClient (); @@ -959,6 +1064,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginReceive () { UdpClient client = new UdpClient (1237); @@ -984,6 +1092,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Available () { using (UdpClient client = new UdpClient (1238)) { @@ -1018,6 +1129,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void EnableBroadcastDefault () { UdpClient client = new UdpClient (); @@ -1057,6 +1171,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void MulticastLoopbackDefault () { UdpClient client = new UdpClient (); @@ -1067,6 +1184,9 @@ namespace MonoTests.System.Net.Sockets { } [Test] // #6057 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveIPv6 () { if (!Socket.OSSupportsIPv6) diff --git a/mcs/class/System/Test/System.Net.WebSockets/ClientWebSocketTest.cs b/mcs/class/System/Test/System.Net.WebSockets/ClientWebSocketTest.cs index 4e7aa5668c3..e3dd58188c1 100644 --- a/mcs/class/System/Test/System.Net.WebSockets/ClientWebSocketTest.cs +++ b/mcs/class/System/Test/System.Net.WebSockets/ClientWebSocketTest.cs @@ -18,31 +18,33 @@ namespace MonoTests.System.Net.WebSockets { const string EchoServerUrl = "ws://corefx-net.cloudapp.net/WebSocket/EchoWebSocket.ashx"; int Port = NetworkHelpers.FindFreePort (); - HttpListener listener; - ClientWebSocket socket; - MethodInfo headerSetMethod; - - [SetUp] - public void Setup () - { - listener = new HttpListener (); - listener.Prefixes.Add ("http://localhost:" + Port + "/"); - listener.Start (); - socket = new ClientWebSocket (); + HttpListener _listener; + HttpListener listener { + get { + if (_listener != null) + return _listener; + var tmp = new HttpListener (); + tmp.Prefixes.Add ("http://localhost:" + Port + "/"); + tmp.Start (); + return _listener = tmp; + } } + ClientWebSocket _socket; + ClientWebSocket socket { get { return _socket ?? (_socket = new ClientWebSocket ()); } } + MethodInfo headerSetMethod; [TearDown] public void Teardown () { - if (listener != null) { - listener.Stop (); - listener = null; + if (_listener != null) { + _listener.Stop (); + _listener = null; } - if (socket != null) { - if (socket.State == WebSocketState.Open) - socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (2000); - socket.Dispose (); - socket = null; + if (_socket != null) { + if (_socket.State == WebSocketState.Open) + _socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (2000); + _socket.Dispose (); + _socket = null; } } diff --git a/mcs/class/System/Test/System.Net/CookieParserTest.cs b/mcs/class/System/Test/System.Net/CookieParserTest.cs index 37c40d7445e..f3c4eceea74 100644 --- a/mcs/class/System/Test/System.Net/CookieParserTest.cs +++ b/mcs/class/System/Test/System.Net/CookieParserTest.cs @@ -9,7 +9,6 @@ using NUnit.Framework; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class CookieParserTest { public const string A = "Foo=Bar, expires=World; expires=Sat, 11-Oct-14 22:45:19 GMT, A=B"; @@ -72,6 +71,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestExpires () { var cookies = DoRequest (A); @@ -82,6 +84,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestInvalidCookie () { var cookies = DoRequest (B); @@ -92,6 +97,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestLocalCulture () { var old = Thread.CurrentThread.CurrentCulture; @@ -109,6 +117,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestMultiple () { var cookies = DoRequest (D); @@ -119,6 +130,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestMultiple2 () { var cookies = DoRequest (E); @@ -128,6 +142,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestQuotation () { var cookies = DoRequest (F); @@ -140,6 +157,7 @@ namespace MonoTests.System.Net { Socket socket; string[] headers; + Exception ex; public Listener (params string[] headers) { @@ -155,17 +173,28 @@ namespace MonoTests.System.Net socket.Bind (new IPEndPoint (IPAddress.Loopback, 0)); socket.Listen (1); socket.BeginAccept ((result) => { - var accepted = socket.EndAccept (result); - HandleRequest (accepted); + try { + var accepted = socket.EndAccept (result); + HandleRequest (accepted); + } catch (Exception e) { + ex = e; + } }, null); } + void ThrowIfException () + { + if (ex != null) + throw ex; + } + public void Dispose () { if (socket != null) { socket.Close (); socket = null; } + ThrowIfException (); } void HandleRequest (Socket accepted) @@ -183,11 +212,17 @@ namespace MonoTests.System.Net } public EndPoint EndPoint { - get { return socket.LocalEndPoint; } + get { + ThrowIfException (); + return socket.LocalEndPoint; + } } public string URI { - get { return string.Format ("http://{0}/", EndPoint); } + get { + ThrowIfException (); + return string.Format ("http://{0}/", EndPoint); + } } } } diff --git a/mcs/class/System/Test/System.Net/DnsTest.cs b/mcs/class/System/Test/System.Net/DnsTest.cs index e06ca4bf5d6..fef01454188 100644 --- a/mcs/class/System/Test/System.Net/DnsTest.cs +++ b/mcs/class/System/Test/System.Net/DnsTest.cs @@ -19,7 +19,6 @@ using NUnit.Framework; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class DnsTest { private String site1Name = "google-public-dns-a.google.com", @@ -30,6 +29,9 @@ namespace MonoTests.System.Net private uint site1IP = 134744072, site2IP = 134743044; // Big-Endian [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AsyncGetHostByName () { IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null); @@ -39,6 +41,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AsyncGetHostByNameCallback () { var evt = new ManualResetEvent (false); @@ -61,6 +66,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AsyncResolve () { IAsyncResult async = Dns.BeginResolve (site1Dot, null, null); @@ -71,6 +79,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AsyncResolveCallback () { var evt = new ManualResetEvent (false); @@ -205,6 +216,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetHostByName () { SubTestGetHostByName (site1Name, site1Dot); @@ -336,6 +350,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginResolve_HostName_Null () { try { @@ -352,6 +369,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Resolve () { SubTestResolve (site1Name); @@ -367,6 +387,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Resolve_HostName_Null () { try { @@ -381,6 +404,9 @@ namespace MonoTests.System.Net } [Test] // BeginGetHostEntry (IPAddress, AsyncCallback, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetHostEntry1_Address_Null () { try { @@ -398,6 +424,9 @@ namespace MonoTests.System.Net } [Test] // BeginGetHostEntry (String, AsyncCallback, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetHostEntry2_HostNameOrAddress_Null () { try { @@ -415,6 +444,9 @@ namespace MonoTests.System.Net } [Test] // BeginGetHostEntry (String, AsyncCallback, Object) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetHostEntry2_HostNameOrAddress_UnspecifiedAddress () { // IPv4 @@ -473,6 +505,9 @@ namespace MonoTests.System.Net } [Test] // GetHostEntry (String) +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetHostEntry2 () { Dns.GetHostEntry (site1Name); // hostname diff --git a/mcs/class/System/Test/System.Net/FileWebRequestTest.cs b/mcs/class/System/Test/System.Net/FileWebRequestTest.cs index 5f4166eecf8..6793d2a48fd 100644 --- a/mcs/class/System/Test/System.Net/FileWebRequestTest.cs +++ b/mcs/class/System/Test/System.Net/FileWebRequestTest.cs @@ -25,7 +25,6 @@ using NUnit.Framework; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class FileWebRequestTest { private string _tempDirectory; diff --git a/mcs/class/System/Test/System.Net/FtpWebRequestTest.cs b/mcs/class/System/Test/System.Net/FtpWebRequestTest.cs index 93697cd2929..8143edd7571 100644 --- a/mcs/class/System/Test/System.Net/FtpWebRequestTest.cs +++ b/mcs/class/System/Test/System.Net/FtpWebRequestTest.cs @@ -19,10 +19,12 @@ using System.Threading; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class FtpWebRequestTest { - FtpWebRequest defaultRequest; + FtpWebRequest _defaultRequest; + FtpWebRequest defaultRequest { + get { return _defaultRequest ?? (_defaultRequest = (FtpWebRequest) WebRequest.Create ("ftp://www.contoso.com")); } + } private string _tempDirectory; private string _tempFile; @@ -49,25 +51,31 @@ namespace MonoTests.System.Net Directory.Delete (_tempDirectory, true); } - [TestFixtureSetUp] - public void Init () - { - defaultRequest = (FtpWebRequest) WebRequest.Create ("ftp://www.contoso.com"); - } - [Test] public void ContentLength () { try { long l = defaultRequest.ContentLength; +#if FEATURE_NO_BSD_SOCKETS + Assert.Fail ("#1a"); + } catch (PlatformNotSupportedException) { + // OK. +#else } catch (NotSupportedException) { Assert.Fail ("#1"); // Not overriden +#endif } try { defaultRequest.ContentLength = 2; +#if FEATURE_NO_BSD_SOCKETS + Assert.Fail ("#2a"); + } catch (PlatformNotSupportedException) { + // OK. +#else } catch (NotSupportedException) { Assert.Fail ("#2"); // Not overriden +#endif } } @@ -88,6 +96,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ContentOffset () { try { @@ -98,6 +109,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Credentials () { try { @@ -109,6 +123,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Method () { try { @@ -146,6 +163,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReadWriteTimeout () { try { @@ -156,6 +176,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Timeout () { try { @@ -166,6 +189,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DefaultValues () { FtpWebRequest request = (FtpWebRequest) WebRequest.Create ("ftp://www.contoso.com"); @@ -183,6 +209,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void RenameTo () { try { @@ -199,6 +228,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UploadFile1 () { ServerPut sp = new ServerPut (); @@ -229,6 +261,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UploadFile_WebClient () { ServerPut sp = new ServerPut (); @@ -247,6 +282,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DownloadFile1 () { DownloadFile (new ServerDownload ()); @@ -279,6 +317,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DownloadFile2 () { // Some embedded FTP servers in Industrial Automation Hardware report @@ -287,6 +328,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DeleteFile1 () { ServerDeleteFile sp = new ServerDeleteFile (); @@ -313,6 +357,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ListDirectory1 () { ServerListDirectory sp = new ServerListDirectory (); diff --git a/mcs/class/System/Test/System.Net/HttpListener2Test.cs b/mcs/class/System/Test/System.Net/HttpListener2Test.cs index b0cedc555a4..51e2990c0d1 100644 --- a/mcs/class/System/Test/System.Net/HttpListener2Test.cs +++ b/mcs/class/System/Test/System.Net/HttpListener2Test.cs @@ -47,7 +47,6 @@ using MonoTests.Helpers; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class HttpListener2Test { private HttpListener _listener = null; @@ -147,6 +146,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test1 () { var port = NetworkHelpers.FindFreePort (); @@ -159,6 +161,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test2 () { var port = NetworkHelpers.FindFreePort (); @@ -171,6 +176,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test3 () { StringBuilder bad = new StringBuilder (); @@ -210,6 +218,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test4 () { var port = NetworkHelpers.FindFreePort (); @@ -222,6 +233,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test5 () { var port = NetworkHelpers.FindFreePort (); @@ -234,6 +248,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test6 () { var port = NetworkHelpers.FindFreePort (); @@ -247,6 +264,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test7 () { var port = NetworkHelpers.FindFreePort (); @@ -263,6 +283,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test8 () { var port = NetworkHelpers.FindFreePort (); @@ -280,6 +303,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test9 () { var port = NetworkHelpers.FindFreePort (); @@ -295,6 +321,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test10 () { var port = NetworkHelpers.FindFreePort (); @@ -311,6 +340,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test11 () { var port = NetworkHelpers.FindFreePort (); @@ -325,6 +357,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test12 () { var port = NetworkHelpers.FindFreePort (); @@ -339,6 +374,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test13 () { var port = NetworkHelpers.FindFreePort (); @@ -356,6 +394,9 @@ namespace MonoTests.System.Net { ManualResetEvent test_evt; bool test14_error; [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test14 () { var port = NetworkHelpers.FindFreePort (); @@ -392,6 +433,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test15 () { var port = NetworkHelpers.FindFreePort (); @@ -414,6 +458,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test16 () { var port = NetworkHelpers.FindFreePort (); @@ -438,6 +485,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test17 () { var port = NetworkHelpers.FindFreePort (); @@ -454,6 +504,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test_MultipleClosesOnOuputStreamAllowed () { var port = NetworkHelpers.FindFreePort (); @@ -484,6 +537,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReceiveCookiesFromClient () { sendCookiePort = NetworkHelpers.FindFreePort (); @@ -530,6 +586,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void SendCookiestoClient () { receiveCookiePort = NetworkHelpers.FindFreePort (); @@ -581,6 +640,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void MultiResponses () { echoServerPort = NetworkHelpers.FindFreePort (); @@ -646,9 +708,11 @@ namespace MonoTests.System.Net { } [TestFixture] - [Category ("RequiresBSDSockets")] public class HttpListenerBugs { [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestNonChunkedAsync () { var port = NetworkHelpers.FindFreePort (); @@ -703,6 +767,9 @@ namespace MonoTests.System.Net { // a documented pattern to close the connection // [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test_MultipleConnections () { var port = NetworkHelpers.FindFreePort (); @@ -733,6 +800,9 @@ namespace MonoTests.System.Net { // Test case for bug 341443, an pretty old bug, filed on November of 2007. // [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test_HostInUri () { var wait = new ManualResetEvent (false); @@ -762,6 +832,9 @@ namespace MonoTests.System.Net { } [Test] // bug #513849 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ClosePort () { var port = NetworkHelpers.FindFreePort (); @@ -785,6 +858,9 @@ namespace MonoTests.System.Net { // does not also listen to another interface. // [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BindToSingleInterface () { IPAddress [] machineAddress = null; @@ -811,6 +887,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BindToAllInterfaces () { var h = new HttpListener (); @@ -823,6 +902,9 @@ namespace MonoTests.System.Net { // Test case for bug #31209 [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Test_EmptyLineAtStart () { var port = NetworkHelpers.FindFreePort (); diff --git a/mcs/class/System/Test/System.Net/HttpListenerPrefixCollectionTest.cs b/mcs/class/System/Test/System.Net/HttpListenerPrefixCollectionTest.cs index 21589dc6c30..b09a8180eaf 100644 --- a/mcs/class/System/Test/System.Net/HttpListenerPrefixCollectionTest.cs +++ b/mcs/class/System/Test/System.Net/HttpListenerPrefixCollectionTest.cs @@ -36,6 +36,9 @@ namespace MonoTests.System.Net { public class HttpListenerPrefixCollectionTest { // NL -> Not listening -> tests when listener.IsListening == false [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void NL_DefaultProperties () { HttpListener listener = new HttpListener (); @@ -46,6 +49,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DefaultProperties () { HttpListener listener = new HttpListener (); @@ -57,7 +63,9 @@ namespace MonoTests.System.Net { } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AddOne () { HttpListener listener = new HttpListener (); @@ -71,7 +79,9 @@ namespace MonoTests.System.Net { } [Test] - [Category ("RequiresBSDSockets")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Duplicate () { HttpListener listener = new HttpListener (); @@ -86,6 +96,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void EndsWithSlash () { HttpListener listener = new HttpListener (); @@ -93,6 +106,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DifferentPath () { HttpListener listener = new HttpListener (); @@ -102,6 +118,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void NL_Clear () { HttpListener listener = new HttpListener (); @@ -110,6 +129,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void NL_Remove () { HttpListener listener = new HttpListener (); @@ -118,6 +140,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void NL_RemoveBadUri () { HttpListener listener = new HttpListener (); @@ -126,7 +151,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentException))] +#endif public void NL_AddBadUri () { HttpListener listener = new HttpListener (); @@ -135,7 +164,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentException))] +#endif public void NoHostInUrl () { HttpListener listener = new HttpListener (); @@ -143,6 +176,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void MultipleSlashes () { // this one throws on Start(), not when adding it. @@ -156,6 +192,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PercentSign () { HttpListener listener = new HttpListener (); @@ -169,6 +208,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Disposed1 () { HttpListener listener = new HttpListener (); @@ -180,7 +222,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void Disposed2 () { HttpListener listener = new HttpListener (); @@ -190,7 +236,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void Disposed3 () { HttpListener listener = new HttpListener (); @@ -200,7 +250,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void Disposed4 () { HttpListener listener = new HttpListener (); @@ -210,7 +264,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void Disposed5 () { HttpListener listener = new HttpListener (); @@ -221,6 +279,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Disposed6 () { HttpListener listener = new HttpListener (); @@ -234,6 +295,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Disposed7 () { HttpListener listener = new HttpListener (); diff --git a/mcs/class/System/Test/System.Net/HttpListenerRequestTest.cs b/mcs/class/System/Test/System.Net/HttpListenerRequestTest.cs index c9227fd5b39..d782103f33e 100644 --- a/mcs/class/System/Test/System.Net/HttpListenerRequestTest.cs +++ b/mcs/class/System/Test/System.Net/HttpListenerRequestTest.cs @@ -42,7 +42,6 @@ using MonoTests.Helpers; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class HttpListenerRequestTest { [Test] @@ -151,6 +150,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void HttpMethod () { var port = NetworkHelpers.FindFreePort (); @@ -165,6 +167,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void HttpBasicAuthScheme () { var port = NetworkHelpers.FindFreePort (); @@ -180,6 +185,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void HttpRequestUriIsNotDecoded () { var port = NetworkHelpers.FindFreePort (); @@ -194,6 +202,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void HttpRequestIsLocal () { var port = NetworkHelpers.FindFreePort (); @@ -221,6 +232,9 @@ namespace MonoTests.System.Net } [Test] // #29927 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void HttpRequestUriUnescape () { var prefix = "http://localhost:" + NetworkHelpers.FindFreePort () + "/"; diff --git a/mcs/class/System/Test/System.Net/HttpListenerTest.cs b/mcs/class/System/Test/System.Net/HttpListenerTest.cs index 70dcede8971..bbd716c0ed2 100644 --- a/mcs/class/System/Test/System.Net/HttpListenerTest.cs +++ b/mcs/class/System/Test/System.Net/HttpListenerTest.cs @@ -37,17 +37,17 @@ using MonoTests.Helpers; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class HttpListenerTest { - int port; - - [SetUp] - public void SetUp () { - port = NetworkHelpers.FindFreePort (); + int? _port; + int port { + get { return _port ?? (_port = NetworkHelpers.FindFreePort ()).Value; } } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DefaultProperties () { HttpListener listener = new HttpListener (); @@ -61,6 +61,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Start1 () { HttpListener listener = new HttpListener (); @@ -68,6 +71,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Stop1 () { HttpListener listener = new HttpListener (); @@ -75,7 +81,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (InvalidOperationException))] +#endif public void GetContext1 () { HttpListener listener = new HttpListener (); @@ -84,7 +94,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (InvalidOperationException))] +#endif public void GetContext2 () { HttpListener listener = new HttpListener (); @@ -94,7 +108,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (InvalidOperationException))] +#endif public void BeginGetContext1 () { HttpListener listener = new HttpListener (); @@ -103,6 +121,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetContext2 () { HttpListener listener = new HttpListener (); @@ -135,6 +156,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DefaultHttpPort () { if (!CanOpenPort (80)) @@ -148,6 +172,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DefaultHttpsPort () { if (!CanOpenPort (443)) @@ -161,6 +188,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TwoListeners_SameAddress () { if (!CanOpenPort (port)) @@ -174,7 +204,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (HttpListenerException))] +#endif public void TwoListeners_SameURL () { if (!CanOpenPort (port)) @@ -188,7 +222,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (HttpListenerException))] +#endif public void MultipleSlashes () { if (!CanOpenPort (port)) @@ -200,7 +238,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (HttpListenerException))] +#endif public void PercentSign () { if (!CanOpenPort (port)) @@ -212,6 +254,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CloseBeforeStart () { HttpListener listener = new HttpListener (); @@ -219,6 +264,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CloseTwice () { if (!CanOpenPort (port)) @@ -231,6 +279,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void StartStopStart () { if (!CanOpenPort (port)) @@ -244,6 +295,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void StartStopDispose () { if (!CanOpenPort (port)) @@ -256,6 +310,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AbortBeforeStart () { HttpListener listener = new HttpListener (); @@ -263,6 +320,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AbortTwice () { if (!CanOpenPort (port)) @@ -275,6 +335,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PropertiesWhenClosed1 () { HttpListener listener = new HttpListener (); @@ -288,7 +351,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void PropertiesWhenClosed2 () { HttpListener listener = new HttpListener (); @@ -297,7 +364,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void PropertiesWhenClosedSet1 () { HttpListener listener = new HttpListener (); @@ -306,7 +377,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void PropertiesWhenClosedSet2 () { HttpListener listener = new HttpListener (); @@ -315,7 +390,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void PropertiesWhenClosedSet3 () { HttpListener listener = new HttpListener (); @@ -324,7 +403,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void PropertiesWhenClosedSet4 () { HttpListener listener = new HttpListener (); @@ -333,7 +416,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ObjectDisposedException))] +#endif public void PropertiesWhenClosedSet5 () { HttpListener listener = new HttpListener (); @@ -342,6 +429,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PropertiesWhenClosed3 () { HttpListener listener = new HttpListener (); @@ -350,6 +440,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CloseWhileBegin () { HttpListener listener = new HttpListener (); @@ -366,6 +459,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AbortWhileBegin () { HttpListener listener = new HttpListener (); @@ -382,7 +478,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (HttpListenerException))] +#endif public void CloseWhileGet () { // "System.Net.HttpListener Exception : The I/O operation has been aborted @@ -399,7 +499,11 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (HttpListenerException))] +#endif public void AbortWhileGet () { // "System.Net.HttpListener Exception : The I/O operation has been aborted @@ -479,6 +583,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ConnectionReuse () { var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/"; @@ -536,6 +643,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UserHeaderWithDoubleMultiValue () { string uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/"; @@ -563,6 +673,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void HttpClientIsDisconnectedCheckForWriteException() { string uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/"; diff --git a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs index 0d5763967b0..a597b4cd0a2 100644 --- a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs +++ b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs @@ -36,7 +36,6 @@ using MonoTests.Helpers; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class HttpWebRequestTest { private Random rand = new Random (); @@ -45,11 +44,16 @@ namespace MonoTests.System.Net [TestFixtureSetUp] public void Setup () { +#if !FEATURE_NO_BSD_SOCKETS ServicePointManager.Expect100Continue = false; +#endif rand.NextBytes (data64KB); } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Proxy_Null () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com"); @@ -60,6 +64,9 @@ namespace MonoTests.System.Net [Test] [Category("InetAccess")] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Sync () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com"); @@ -81,6 +88,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AddRange () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com"); @@ -96,6 +106,9 @@ namespace MonoTests.System.Net } [Test] // bug #471782 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CloseRequestStreamAfterReadingResponse () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -182,6 +195,9 @@ namespace MonoTests.System.Net } #endif [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Missing_ContentEncoding () { ServicePointManager.CertificatePolicy = new AcceptAllPolicy (); @@ -204,6 +220,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BadServer_ChunkedClose () { // The server will send a chunked response without a 'last-chunked' mark @@ -269,6 +288,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetRequestStream_Body_NotAllowed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -306,6 +328,9 @@ namespace MonoTests.System.Net } [Test] // bug #465613 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetRequestStream_NoBuffering () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -455,6 +480,9 @@ namespace MonoTests.System.Net } [Test] // bug #511851 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetRequestStream_Request_Aborted () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -480,6 +508,9 @@ namespace MonoTests.System.Net } [Test] // bug #511851 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetResponse_Request_Aborted () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -505,6 +536,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void EndGetRequestStream_AsyncResult_Null () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -583,6 +617,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void EndGetResponse_AsyncResult_Null () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -614,6 +651,9 @@ namespace MonoTests.System.Net } [Test] // bug #429200 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetRequestStream () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -636,6 +676,9 @@ namespace MonoTests.System.Net } [Test] // bug #511851 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetRequestStream_Request_Aborted () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -931,6 +974,9 @@ namespace MonoTests.System.Net } [Test] // bug #511851 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetResponse_Request_Aborted () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -987,6 +1033,9 @@ namespace MonoTests.System.Net } [Test] // bug #324300 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AllowAutoRedirect () { IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint (); @@ -1033,6 +1082,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PostAndRedirect_NoCL () { IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint (); @@ -1061,6 +1113,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PostAndRedirect_CL () { IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint (); @@ -1089,6 +1144,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PostAnd401 () { IPEndPoint localEP = NetworkHelpers.LocalEphemeralEndPoint (); @@ -1250,6 +1308,9 @@ namespace MonoTests.System.Net } [Test] // bug #513087 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void NonStandardVerb () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -1361,11 +1422,11 @@ namespace MonoTests.System.Net internal void LaunchWebRequest () { - var req = (HttpWebRequest) WebRequest.Create (url_to_test); - req.Timeout = TimeOutInMilliSeconds; - - Start = DateTime.Now; try { + var req = (HttpWebRequest) WebRequest.Create (url_to_test); + req.Timeout = TimeOutInMilliSeconds; + + Start = DateTime.Now; using (var resp = (HttpWebResponse) req.GetResponse ()) { var sr = new StreamReader (resp.GetResponseStream (), Encoding.UTF8); @@ -1416,6 +1477,9 @@ namespace MonoTests.System.Net } [Test] // 1st possible case of https://bugzilla.novell.com/show_bug.cgi?id=MONO74177 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestTimeoutPropertyWithServerThatExistsAndRespondsButTooLate () { var ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -1428,6 +1492,7 @@ namespace MonoTests.System.Net } [Test] // 2nd possible case of https://bugzilla.novell.com/show_bug.cgi?id=MONO74177 + [Category ("RequiresBSDSockets")] // Requires some test refactoring to assert that a PlatformNotSupportedException is thrown, so don't bother (there's plenty of other tests asserting the PlatformNotSupported exceptions). public void TestTimeoutWithEndpointThatDoesntExistThrowsConnectFailureBeforeTimeout () { string url = "http://127.0.0.1:8271/"; // some endpoint that is unlikely to exist @@ -1682,6 +1747,9 @@ namespace MonoTests.System.Net return Encoding.UTF8.GetBytes (sw.ToString ()); } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void NtlmAuthentication () { NtlmServer server = new NtlmServer (); @@ -1824,6 +1892,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetRequestStream () { this.DoRequest ( @@ -1842,6 +1913,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetRequestStreamNoClose () { this.DoRequest ( @@ -1859,6 +1933,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetRequestStreamCancelIfNotAllBytesWritten () { this.DoRequest ( @@ -1883,6 +1960,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetRequestStream2 () { this.DoRequest ( @@ -1899,6 +1979,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetRequestStreamNotAllBytesWritten () { this.DoRequest ( @@ -1914,6 +1997,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetRequestStreamTimeout () { this.DoRequest ( @@ -1929,6 +2015,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginWrite () { byte[] received = new byte[data64KB.Length]; @@ -1961,6 +2050,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginWriteAfterAbort () { byte [] received = new byte [data64KB.Length]; @@ -1988,6 +2080,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PrematureStreamCloseAborts () { byte [] received = new byte [data64KB.Length]; @@ -2015,6 +2110,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Write () { byte [] received = new byte [data64KB.Length]; @@ -2086,6 +2184,9 @@ namespace MonoTests.System.Net **/ [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Read () { byte [] received = new byte [data64KB.Length]; @@ -2113,6 +2214,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReadTimeout2 () { byte [] received = new byte [data64KB.Length]; @@ -2142,6 +2246,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReadServerAborted () { byte [] received = new byte [data64KB.Length]; @@ -2166,6 +2273,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetResponse2 () { byte [] received = new byte [data64KB.Length]; @@ -2196,6 +2306,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginGetResponseAborts () { ManualResetEvent aborted = new ManualResetEvent(false); @@ -2226,6 +2339,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void TestLargeDataReading () { int near2GBStartPosition = rand.Next (int.MaxValue - 500, int.MaxValue); @@ -2323,7 +2439,11 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentNullException))] +#endif public void NullHost () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com"); @@ -2331,6 +2451,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void NoHost () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com"); @@ -2338,7 +2461,11 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentException))] +#endif public void EmptyHost () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com"); @@ -2346,6 +2473,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void HostAndPort () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com:80"); @@ -2355,6 +2485,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void PortRange () { for (int i = 0; i < 65536; i++) { @@ -2367,7 +2500,11 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentException))] +#endif public void PortBelow () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com"); @@ -2375,7 +2512,11 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentException))] +#endif public void PortAbove () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com"); @@ -2383,7 +2524,11 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#else [ExpectedException (typeof (ArgumentException))] +#endif public void HostTooLong () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com"); @@ -2403,6 +2548,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void NoDate () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com"); @@ -2410,6 +2558,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UtcDate () { HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://go-mono.com"); @@ -2419,6 +2570,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AddAndRemoveDate () { // Neil Armstrong set his foot on Moon @@ -2452,6 +2606,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif // Bug #12393 public void TestIPv6Host () { @@ -2483,6 +2640,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AllowReadStreamBuffering () { var hr = WebRequest.CreateHttp ("http://www.google.com"); @@ -2680,6 +2840,9 @@ namespace MonoTests.System.Net #endif [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CookieContainerTest () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -2761,10 +2924,12 @@ namespace MonoTests.System.Net } [TestFixture] - [Category ("RequiresBSDSockets")] public class HttpRequestStreamTest { [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginRead () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -2820,6 +2985,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CanRead () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -2842,6 +3010,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CanSeek () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -2864,6 +3035,9 @@ namespace MonoTests.System.Net } [Test] // bug #324182 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CanTimeout () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -2886,6 +3060,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CanWrite () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -2908,6 +3085,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Read () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -2935,6 +3115,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReadByte () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -2961,6 +3144,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReadTimeout () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -2983,6 +3169,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Seek () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -3009,6 +3198,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Write_Buffer_Null () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -3035,6 +3227,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Write_Count_Negative () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -3063,6 +3258,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Write_Count_Overflow () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -3091,6 +3289,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Write_Offset_Negative () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -3119,6 +3320,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Write_Offset_Overflow () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -3147,6 +3351,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Write_Request_Aborted () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -3202,6 +3409,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void WriteByte_Request_Aborted () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -3229,6 +3439,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void WriteTimeout () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -3251,6 +3464,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif // Bug6737 // This test is supposed to fail prior to .NET 4.0 public void Post_EmptyRequestStream () diff --git a/mcs/class/System/Test/System.Net/HttpWebResponseTest.cs b/mcs/class/System/Test/System.Net/HttpWebResponseTest.cs index 10d7d807444..b2c8e90488c 100644 --- a/mcs/class/System/Test/System.Net/HttpWebResponseTest.cs +++ b/mcs/class/System/Test/System.Net/HttpWebResponseTest.cs @@ -21,10 +21,12 @@ using NUnit.Framework; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class HttpWebResponseTest { [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CharacterSet_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -53,6 +55,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Close_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -72,6 +77,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ContentEncoding_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -100,6 +108,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ContentLength_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -120,6 +131,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ContentType_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -148,6 +162,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Cookies_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -186,6 +203,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetResponseHeader_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -214,6 +234,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void GetResponseStream_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -242,6 +265,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Headers_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -269,6 +295,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void LastModified_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -297,6 +326,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Method_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -325,6 +357,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ProtocolVersion_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -353,6 +388,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ResponseUri_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -381,6 +419,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Server_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -409,6 +450,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void StatusCode_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -429,6 +473,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void StatusDescription_Disposed () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -477,10 +524,12 @@ namespace MonoTests.System.Net } [TestFixture] - [Category ("RequiresBSDSockets")] public class HttpResponseStreamTest { [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginRead_Buffer_Null () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -530,6 +579,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void BeginWrite () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -590,6 +642,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CanSeek () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -617,6 +672,9 @@ namespace MonoTests.System.Net } [Test] // bug #324182 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CanTimeout () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -644,6 +702,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CanWrite () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -671,6 +732,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Read () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -708,6 +772,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Read_Buffer_Null () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -757,6 +824,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Read_Count_Negative () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -807,6 +877,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Read_Count_Overflow () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -857,6 +930,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Read_Offset_Negative () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -907,6 +983,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Read_Offset_Overflow () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -1021,6 +1100,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void ReadTimeout () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -1048,6 +1130,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void Write () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); @@ -1080,6 +1165,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void WriteTimeout () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint(); diff --git a/mcs/class/System/Test/System.Net/ServicePointTest.cs b/mcs/class/System/Test/System.Net/ServicePointTest.cs index 346f35bdeac..1e848148f92 100644 --- a/mcs/class/System/Test/System.Net/ServicePointTest.cs +++ b/mcs/class/System/Test/System.Net/ServicePointTest.cs @@ -13,7 +13,7 @@ using System; using System.Collections; using System.IO; using System.Net; -using System.Reflection; +using System.Reflection; using System.Threading; namespace MonoTests.System.Net @@ -54,13 +54,13 @@ public class ServicePointTest HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com"); HttpWebResponse res = (HttpWebResponse) req.GetResponse (); -#if FOUND_SOME_OTHER_URL - // URL is no longer found, disabled the test until a more reliable URL is found :P +#if FOUND_SOME_OTHER_URL + // URL is no longer found, disabled the test until a more reliable URL is found :P //WriteServicePoint ("google after getting a response", google); ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html")); Assert.AreEqual (google, google2, "#equals"); res.Close (); -#endif +#endif // in both instances property CurrentConnections is 0 according to ms.net. // let's see what it says when we do async operations... @@ -87,8 +87,8 @@ public class ServicePointTest //Console.WriteLine ("ContentLength: " + res2.ContentLength); res2.Close (); - ServicePoint sp2; -#if FOUND_SOME_OTHER_URL + ServicePoint sp2; +#if FOUND_SOME_OTHER_URL // unless of course some buffering is taking place.. let's check Uri uri2 = new Uri ("http://freedesktop.org/Software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz"); sp2 = ServicePointManager.FindServicePoint (uri2); @@ -102,7 +102,7 @@ public class ServicePointTest // and so it shows //Console.WriteLine ("ContentLength: " + res2.ContentLength); res2.Close (); -#endif +#endif // what's the limit of the cache? @@ -154,7 +154,7 @@ public class ServicePointTest [Test] [Category ("InetAccess")] - [Category ("AndroidNotWorking")] // #A1 fails + [Category ("AndroidNotWorking")] // #A1 fails public void EndPointBind () { Uri uri = new Uri ("http://www.go-mono.com/"); @@ -189,6 +189,10 @@ public class ServicePointTest } [Test] //Covers #19823 +#if FEATURE_NO_BSD_SOCKETS + // This test uses HttpWebRequest + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void CloseConnectionGroupConcurency () { // Try with multiple service points @@ -206,36 +210,37 @@ public class ServicePointTest } } - - [Test] - public void DnsRefreshTimeout () - { - const int dnsRefreshTimeout = 2000; - - ServicePoint sp; - IPHostEntry host0, host1, host2; - Uri uri; - PropertyInfo hostEntryProperty; - - ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout; - - uri = new Uri ("http://localhost/"); - sp = ServicePointManager.FindServicePoint (uri); - - hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance); - - host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry; - host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry; - - Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object."); - - Thread.Sleep (dnsRefreshTimeout * 2); - host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry; - - Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " + - "object when DnsRefreshTimeout is reached."); - } - + + [Test] + [Category ("RequiresBSDSockets")] // Tests internals, so it doesn't make sense to assert that PlatformNotSupportedExceptions are thrown. + public void DnsRefreshTimeout () + { + const int dnsRefreshTimeout = 2000; + + ServicePoint sp; + IPHostEntry host0, host1, host2; + Uri uri; + PropertyInfo hostEntryProperty; + + ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout; + + uri = new Uri ("http://localhost/"); + sp = ServicePointManager.FindServicePoint (uri); + + hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance); + + host0 = hostEntryProperty.GetValue (sp, null) as IPHostEntry; + host1 = hostEntryProperty.GetValue (sp, null) as IPHostEntry; + + Assert.AreSame (host0, host1, "HostEntry should result in the same IPHostEntry object."); + + Thread.Sleep (dnsRefreshTimeout * 2); + host2 = hostEntryProperty.GetValue (sp, null) as IPHostEntry; + + Assert.AreNotSame(host0, host2, "HostEntry should result in a new IPHostEntry " + + "object when DnsRefreshTimeout is reached."); + } + // Debug code not used now, but could be useful later /* private void WriteServicePoint (string label, ServicePoint sp) diff --git a/mcs/class/System/Test/System.Net/WebClientTest.cs b/mcs/class/System/Test/System.Net/WebClientTest.cs index 1a6c45179aa..3b048781f29 100644 --- a/mcs/class/System/Test/System.Net/WebClientTest.cs +++ b/mcs/class/System/Test/System.Net/WebClientTest.cs @@ -21,7 +21,6 @@ using MonoTests.Helpers; namespace MonoTests.System.Net { [TestFixture] - [Category ("RequiresBSDSockets")] public class WebClientTest { private string _tempFolder; @@ -1419,6 +1418,9 @@ namespace MonoTests.System.Net [Test] [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UploadValues1 () { IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint (); @@ -1669,6 +1671,10 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + // We throw a PlatformNotSupportedException deeper, which is caught and re-thrown as WebException + [ExpectedException (typeof (WebException))] +#endif public void GetWebRequestOverriding () { GetWebRequestOverridingTestClass testObject = new GetWebRequestOverridingTestClass (); @@ -1783,6 +1789,9 @@ namespace MonoTests.System.Net [Test] [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UploadStringAsyncCancelEvent () { UploadAsyncCancelEventTest (9301, (webClient, uri, cancelEvent) => @@ -1800,6 +1809,9 @@ namespace MonoTests.System.Net [Test] [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UploadDataAsyncCancelEvent () { UploadAsyncCancelEventTest (9302, (webClient, uri, cancelEvent) => @@ -1816,6 +1828,9 @@ namespace MonoTests.System.Net [Test] [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UploadValuesAsyncCancelEvent () { UploadAsyncCancelEventTest (9303, (webClient, uri, cancelEvent) => @@ -1832,6 +1847,9 @@ namespace MonoTests.System.Net [Test] [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UploadFileAsyncCancelEvent () { UploadAsyncCancelEventTest (9304,(webClient, uri, cancelEvent) => @@ -1851,6 +1869,9 @@ namespace MonoTests.System.Net [Test] [Category ("AndroidNotWorking")] // Test suite hangs if the tests runs as part of the entire BCL suite. Works when only this fixture is ran +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void UploadFileAsyncContentType () { var port = NetworkHelpers.FindFreePort (); diff --git a/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs b/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs index 1e21e43dc21..c2bdeba6ab2 100644 --- a/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs +++ b/mcs/class/System/Test/System.Net/WebHeaderCollectionTest.cs @@ -124,6 +124,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void AddRestricted () { col = CreateRestrictedHeaders (); @@ -236,6 +239,9 @@ namespace MonoTests.System.Net } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void RemoveRestricted () { col = CreateRestrictedHeaders (); diff --git a/mcs/class/System/Test/System.Net/WebRequestTest.cs b/mcs/class/System/Test/System.Net/WebRequestTest.cs index 34ce1a370a1..074c97d6982 100644 --- a/mcs/class/System/Test/System.Net/WebRequestTest.cs +++ b/mcs/class/System/Test/System.Net/WebRequestTest.cs @@ -11,10 +11,10 @@ // using NUnit.Framework; -using MonoTests.Helpers; +using MonoTests.Helpers; using System; using System.Net; -using System.Threading; +using System.Threading; using System.Collections; using System.Runtime.Serialization; using Socks = System.Net.Sockets; @@ -193,6 +193,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void All () { WebRequest req = WebRequest.Create ("http://www.contoso.com"); @@ -264,6 +267,9 @@ namespace MonoTests.System.Net { } [Test] +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif public void DefaultWebProxy () { WebProxy proxy = new WebProxy ("proxy.intern.com", 83); @@ -318,14 +324,18 @@ namespace MonoTests.System.Net { } [Test] //BNC#323452 - // Throws exception with Status == Timeout. The same code behaves as the test expects when run from a regular app. - // Might be an issue with the test suite. To investigate. - [Category("AndroidNotWorking")] + // Throws exception with Status == Timeout. The same code behaves as the test expects when run from a regular app. + // Might be an issue with the test suite. To investigate. + [Category("AndroidNotWorking")] public void TestFailedConnection () { try { WebRequest.Create ("http://127.0.0.1:0/non-existant.txt").GetResponse (); Assert.Fail ("Should have raised an exception"); +#if FEATURE_NO_BSD_SOCKETS + } catch (PlatformNotSupportedException) { + // Expected +#endif } catch (Exception e) { Assert.IsTrue (e is WebException, "Got " + e.GetType ().Name + ": " + e.Message); //#if NET_2_0 e.Message == "Unable to connect to the remote server" @@ -342,7 +352,7 @@ namespace MonoTests.System.Net { } [Test] //BNC#323452 - [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran + [Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran public void TestFailedResolution () { try { @@ -359,6 +369,10 @@ namespace MonoTests.System.Net { Assert.Ignore ("Misbehaving DNS server."); Assert.Fail ("Should have raised an exception"); +#if FEATURE_NO_BSD_SOCKETS + } catch (PlatformNotSupportedException) { + // Expected +#endif } catch (Exception e) { Assert.IsTrue (e is WebException); //#if NET_2_0 e.Message == "The underlying connection was closed: The remote name could not be resolved." @@ -412,53 +426,55 @@ namespace MonoTests.System.Net { { internal TestWebRequest3 () { } } - - [Test] // Covers #41477 - [Category ("RequiresBSDSockets")] - public void TestReceiveCancelation () - { - var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/"; - - HttpListener listener = new HttpListener (); - listener.Prefixes.Add (uri); - listener.Start (); - - try { - for (var i = 0; i < 10; i++) { - var request = WebRequest.CreateHttp (uri); - request.Method = "GET"; - - var tokenSource = new CancellationTokenSource (); - tokenSource.Token.Register(() => request.Abort ()); - - var responseTask = request.GetResponseAsync (); - - var context = listener.GetContext (); - byte[] outBuffer = new byte[8 * 1024]; - context.Response.OutputStream.WriteAsync (outBuffer, 0, outBuffer.Length); - - Assert.IsTrue (responseTask.Wait (1000), "Timeout #1"); - - WebResponse response = responseTask.Result; - var stream = response.GetResponseStream (); - - byte[] buffer = new byte[8 * 1024]; - var taskRead = stream.ReadAsync (buffer, 0, buffer.Length, tokenSource.Token); - - tokenSource.Cancel (); - - Assert.IsTrue (taskRead.Wait (1000), "Timeout #2"); - - var byteRead = taskRead.Result; - } - } catch (AggregateException ex) { - var webEx = ex.InnerException as WebException; - Assert.IsNotNull(webEx, "Inner exception is not a WebException"); - Assert.AreEqual (webEx.Status, WebExceptionStatus.RequestCanceled); - } - - listener.Close (); - } + + [Test] // Covers #41477 +#if FEATURE_NO_BSD_SOCKETS + [ExpectedException (typeof (PlatformNotSupportedException))] +#endif + public void TestReceiveCancelation () + { + var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/"; + + HttpListener listener = new HttpListener (); + listener.Prefixes.Add (uri); + listener.Start (); + + try { + for (var i = 0; i < 10; i++) { + var request = WebRequest.CreateHttp (uri); + request.Method = "GET"; + + var tokenSource = new CancellationTokenSource (); + tokenSource.Token.Register(() => request.Abort ()); + + var responseTask = request.GetResponseAsync (); + + var context = listener.GetContext (); + byte[] outBuffer = new byte[8 * 1024]; + context.Response.OutputStream.WriteAsync (outBuffer, 0, outBuffer.Length); + + Assert.IsTrue (responseTask.Wait (1000), "Timeout #1"); + + WebResponse response = responseTask.Result; + var stream = response.GetResponseStream (); + + byte[] buffer = new byte[8 * 1024]; + var taskRead = stream.ReadAsync (buffer, 0, buffer.Length, tokenSource.Token); + + tokenSource.Cancel (); + + Assert.IsTrue (taskRead.Wait (1000), "Timeout #2"); + + var byteRead = taskRead.Result; + } + } catch (AggregateException ex) { + var webEx = ex.InnerException as WebException; + Assert.IsNotNull(webEx, "Inner exception is not a WebException"); + Assert.AreEqual (webEx.Status, WebExceptionStatus.RequestCanceled); + } + + listener.Close (); + } } } diff --git a/mcs/class/System/mobile_System.dll.sources b/mcs/class/System/mobile_System.dll.sources index a815d696758..906ca8c1343 100644 --- a/mcs/class/System/mobile_System.dll.sources +++ b/mcs/class/System/mobile_System.dll.sources @@ -173,6 +173,7 @@ System.Net/HttpListenerContext.cs System.Net/HttpListenerPrefixCollection.cs System.Net/HttpListenerRequest.cs System.Net/HttpListenerResponse.cs +System.Net/HttpListenerResponseHelper.cs System.Net/HttpListenerTimeoutManager.cs System.Net/HttpRequestCreator.cs System.Net/HttpStreamAsyncResult.cs diff --git a/mcs/class/System/monotouch_watch_System.dll.exclude.sources b/mcs/class/System/monotouch_watch_System.dll.exclude.sources new file mode 100644 index 00000000000..ce4674bcac2 --- /dev/null +++ b/mcs/class/System/monotouch_watch_System.dll.exclude.sources @@ -0,0 +1,27 @@ +Mono.Net.Security/LegacySslStream.cs +Mono.Net.Security/MonoLegacyTlsProvider.cs +System.Net.Mail/SmtpClient.cs +System.Net.Sockets/TcpClient.cs +System.Net.Sockets/TcpListener.cs +System.Net.Sockets/UdpClient.cs +System.Net.WebSockets/ClientWebSocket.cs +System.Net/ChunkedInputStream.cs +System.Net/EndPointListener.cs +System.Net/EndPointManager.cs +System.Net/FtpAsyncResult.cs +System.Net/FtpDataStream.cs +System.Net/FtpRequestCreator.cs +System.Net/FtpRequestCreator.cs +System.Net/FtpStatus.cs +System.Net/FtpWebRequest.cs +System.Net/FtpWebResponse.cs +System.Net/HttpConnection.cs +System.Net/HttpListener.cs +System.Net/HttpListenerContext.cs +System.Net/HttpListenerPrefixCollection.cs +System.Net/HttpListenerRequest.cs +System.Net/HttpListenerResponse.cs +System.Net/HttpWebRequest.cs +System.Net/HttpWebResponse.cs +System.Net/ListenerAsyncResult.cs +System.Net/ResponseStream.cs diff --git a/mcs/class/System/monotouch_watch_System.dll.sources b/mcs/class/System/monotouch_watch_System.dll.sources index 7c0bd5983a5..b606c440802 100644 --- a/mcs/class/System/monotouch_watch_System.dll.sources +++ b/mcs/class/System/monotouch_watch_System.dll.sources @@ -1 +1,16 @@ #include monotouch_System.dll.sources +System.Net.Mail/SmtpClient.platformnotsupported.cs +System.Net.Sockets/TcpClient.platformnotsupported.cs +System.Net.Sockets/TcpListener.platformnotsupported.cs +System.Net.Sockets/UdpClient.platformnotsupported.cs +System.Net.WebSockets/ClientWebSocket.platformnotsupported.cs +System.Net/FtpRequestCreator.platformnotsupported.cs +System.Net/FtpWebRequest.platformnotsupported.cs +System.Net/FtpWebResponse.platformnotsupported.cs +System.Net/HttpListener.platformnotsupported.cs +System.Net/HttpListenerContext.platformnotsupported.cs +System.Net/HttpListenerPrefixCollection.platformnotsupported.cs +System.Net/HttpListenerRequest.platformnotsupported.cs +System.Net/HttpListenerResponse.platformnotsupported.cs +System.Net/HttpWebRequest.platformnotsupported.cs +System.Net/HttpWebResponse.platformnotsupported.cs -- 2.25.1