You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
@@ -184,5 +184,31 @@ namespace MonoTests.System.Net
|
||||
Assert.AreEqual ("/RequestUriDecodeTest/?a=b&c=d%26e", request.Url.PathAndQuery);
|
||||
listener.Close ();
|
||||
}
|
||||
|
||||
[Test] // #29927
|
||||
public void HttpRequestUriUnescape ()
|
||||
{
|
||||
var prefix = "http://localhost:12345/";
|
||||
var key = "Product/1";
|
||||
|
||||
var expectedUrl = prefix + key + "/";
|
||||
var rawUrl = prefix + Uri.EscapeDataString (key) + "/";
|
||||
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add (prefix);
|
||||
listener.Start ();
|
||||
|
||||
var contextTask = listener.GetContextAsync ();
|
||||
|
||||
var request = (HttpWebRequest) WebRequest.Create (rawUrl);
|
||||
request.GetResponseAsync ();
|
||||
|
||||
if(!contextTask.Wait (1000))
|
||||
Assert.Fail ("Timeout");
|
||||
|
||||
Assert.AreEqual (expectedUrl, contextTask.Result.Request.Url.AbsoluteUri);
|
||||
|
||||
listener.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Net {
|
||||
[TestFixture]
|
||||
@@ -40,7 +41,7 @@ namespace MonoTests.System.Net {
|
||||
|
||||
[SetUp]
|
||||
public void SetUp () {
|
||||
port = new Random ().Next (7777, 8000);
|
||||
port = NetworkHelpers.FindFreePort ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -475,9 +476,10 @@ namespace MonoTests.System.Net {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Fails ("reuse1") when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||
public void ConnectionReuse ()
|
||||
{
|
||||
var uri = "http://localhost:1338/";
|
||||
var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
|
||||
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add (uri);
|
||||
|
||||
@@ -1 +1 @@
|
||||
326ff298024580ff7205d0cafe3cd61ce9165310
|
||||
3a7ce31d0c602f28af3549eefc482fcb33d7e65a
|
||||
@@ -14,6 +14,8 @@ using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Net
|
||||
@@ -24,7 +26,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void CharacterSet_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -54,7 +56,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Close_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -75,7 +77,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void ContentEncoding_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -105,7 +107,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void ContentLength_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -127,7 +129,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void ContentType_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -157,7 +159,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Cookies_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -197,7 +199,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void GetResponseHeader_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -227,7 +229,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void GetResponseStream_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -257,7 +259,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Headers_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -286,7 +288,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void LastModified_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -316,7 +318,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Method_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -346,7 +348,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void ProtocolVersion_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -376,7 +378,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void ResponseUri_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -406,7 +408,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Server_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -436,7 +438,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void StatusCode_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -458,7 +460,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void StatusDescription_Disposed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (FullResponseHandler))) {
|
||||
@@ -511,7 +513,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void BeginRead_Buffer_Null ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -562,7 +564,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void BeginWrite ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -597,7 +599,7 @@ namespace MonoTests.System.Net
|
||||
[Category ("NotWorking")]
|
||||
public void CanRead ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -626,7 +628,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void CanSeek ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -655,7 +657,7 @@ namespace MonoTests.System.Net
|
||||
[Test] // bug #324182
|
||||
public void CanTimeout ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -684,7 +686,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void CanWrite ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -713,7 +715,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Read ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -752,7 +754,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Read_Buffer_Null ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -803,7 +805,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Read_Count_Negative ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -855,7 +857,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Read_Count_Overflow ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -907,7 +909,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Read_Offset_Negative ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -959,7 +961,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Read_Offset_Overflow ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -1012,7 +1014,7 @@ namespace MonoTests.System.Net
|
||||
[Category ("NotWorking")]
|
||||
public void Read_Stream_Closed ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -1077,7 +1079,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void ReadTimeout ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -1106,7 +1108,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void Write ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
@@ -1140,7 +1142,7 @@ namespace MonoTests.System.Net
|
||||
[Test]
|
||||
public void WriteTimeout ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (HttpWebResponseTest.FullResponseHandler))) {
|
||||
|
||||
@@ -87,7 +87,7 @@ public class ServicePointManagerTest
|
||||
ServicePointManager.MaxServicePoints = 0;
|
||||
ServicePoint sp = ServicePointManager.FindServicePoint (googleUri, new WebProxy (apacheUri));
|
||||
Assert.AreEqual (apacheUri, sp.Address, "#1");
|
||||
#if NET_2_1
|
||||
#if NET_2_1 && !MONODROID
|
||||
Assert.AreEqual (10, sp.ConnectionLimit, "#2");
|
||||
#else
|
||||
Assert.AreEqual (2, sp.ConnectionLimit, "#2");
|
||||
|
||||
@@ -53,10 +53,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
|
||||
//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
|
||||
|
||||
// in both instances property CurrentConnections is 0 according to ms.net.
|
||||
// let's see what it says when we do async operations...
|
||||
@@ -83,10 +86,11 @@ public class ServicePointTest
|
||||
//Console.WriteLine ("ContentLength: " + res2.ContentLength);
|
||||
res2.Close ();
|
||||
|
||||
|
||||
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");
|
||||
ServicePoint sp2 = ServicePointManager.FindServicePoint (uri2);
|
||||
sp2 = ServicePointManager.FindServicePoint (uri2);
|
||||
req2 = (HttpWebRequest) WebRequest.Create (uri2);
|
||||
async = req2.BeginGetResponse (null, null);
|
||||
//WriteServicePoint ("Large file: after async BeginGetResponse", sp2);
|
||||
@@ -97,6 +101,7 @@ public class ServicePointTest
|
||||
// and so it shows
|
||||
//Console.WriteLine ("ContentLength: " + res2.ContentLength);
|
||||
res2.Close ();
|
||||
#endif
|
||||
|
||||
|
||||
// what's the limit of the cache?
|
||||
@@ -148,6 +153,7 @@ public class ServicePointTest
|
||||
|
||||
[Test]
|
||||
[Category ("InetAccess")]
|
||||
[Category ("AndroidNotWorking")] // #A1 fails
|
||||
public void EndPointBind ()
|
||||
{
|
||||
Uri uri = new Uri ("http://www.go-mono.com/");
|
||||
@@ -163,7 +169,7 @@ public class ServicePointTest
|
||||
};
|
||||
req.GetResponse ().Close ();
|
||||
|
||||
Assert.IsTrue (called);
|
||||
Assert.IsTrue (called, "#A1");
|
||||
|
||||
req = (HttpWebRequest) WebRequest.Create (uri);
|
||||
called = false;
|
||||
@@ -174,7 +180,29 @@ public class ServicePointTest
|
||||
};
|
||||
req.GetResponse ().Close ();
|
||||
|
||||
Assert.IsTrue (called);
|
||||
Assert.IsTrue (called, "#A2");
|
||||
}
|
||||
|
||||
public static void GetRequestStreamCallback (IAsyncResult asynchronousResult)
|
||||
{
|
||||
}
|
||||
|
||||
[Test] //Covers #19823
|
||||
public void CloseConnectionGroupConcurency ()
|
||||
{
|
||||
// Try with multiple service points
|
||||
for (var i = 0; i < 10; i++) {
|
||||
Uri targetUri = new Uri ("http://" + i + ".mono-project.com");
|
||||
var req = (HttpWebRequest) HttpWebRequest.Create (targetUri);
|
||||
req.ContentType = "application/x-www-form-urlencoded";
|
||||
req.Method = "POST";
|
||||
req.ConnectionGroupName = "" + i;
|
||||
req.ServicePoint.MaxIdleTime = 1;
|
||||
|
||||
req.BeginGetRequestStream (new AsyncCallback (GetRequestStreamCallback), req);
|
||||
Thread.Sleep (1);
|
||||
req.ServicePoint.CloseConnectionGroup (req.ConnectionGroupName);
|
||||
}
|
||||
}
|
||||
|
||||
// Debug code not used now, but could be useful later
|
||||
|
||||
@@ -119,6 +119,14 @@ namespace MonoTests.System.Net
|
||||
// ignore interruption of blocking call
|
||||
if (ex.ErrorCode != SOCKET_CLOSED && ex.ErrorCode != SOCKET_INVALID_ARGS)
|
||||
throw;
|
||||
#if MOBILE
|
||||
} catch (InvalidOperationException ex) {
|
||||
// This breaks some tests running on Android. The problem is that the stack trace
|
||||
// doesn't point to where the exception is actually thrown from but the entire process
|
||||
// is aborted because of unhandled exception.
|
||||
Console.WriteLine ("SocketResponder.Listen failed:");
|
||||
Console.WriteLine (ex);
|
||||
#endif
|
||||
} finally {
|
||||
Thread.Sleep (500);
|
||||
if (socket != null)
|
||||
|
||||
@@ -16,6 +16,8 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Net
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -1415,10 +1417,11 @@ 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
|
||||
public void UploadValues1 ()
|
||||
{
|
||||
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
string url = "http://" + IPAddress.Loopback.ToString () + ":8000/test/";
|
||||
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString () + "/test/";
|
||||
|
||||
using (SocketResponder responder = new SocketResponder (ep, new SocketRequestHandler (EchoRequestHandler))) {
|
||||
responder.Start ();
|
||||
@@ -1781,9 +1784,10 @@ namespace MonoTests.System.Net
|
||||
|
||||
#if NET_4_5
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||
public void UploadStringAsyncCancelEvent ()
|
||||
{
|
||||
UploadAsyncCancelEventTest ((webClient, uri, cancelEvent) =>
|
||||
UploadAsyncCancelEventTest (9301, (webClient, uri, cancelEvent) =>
|
||||
{
|
||||
|
||||
webClient.UploadStringCompleted += (sender, args) =>
|
||||
@@ -1797,9 +1801,10 @@ 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
|
||||
public void UploadDataAsyncCancelEvent ()
|
||||
{
|
||||
UploadAsyncCancelEventTest ((webClient, uri, cancelEvent) =>
|
||||
UploadAsyncCancelEventTest (9302, (webClient, uri, cancelEvent) =>
|
||||
{
|
||||
webClient.UploadDataCompleted += (sender, args) =>
|
||||
{
|
||||
@@ -1812,9 +1817,10 @@ 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
|
||||
public void UploadValuesAsyncCancelEvent ()
|
||||
{
|
||||
UploadAsyncCancelEventTest ((webClient, uri, cancelEvent) =>
|
||||
UploadAsyncCancelEventTest (9303, (webClient, uri, cancelEvent) =>
|
||||
{
|
||||
webClient.UploadValuesCompleted += (sender, args) =>
|
||||
{
|
||||
@@ -1827,9 +1833,10 @@ 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
|
||||
public void UploadFileAsyncCancelEvent ()
|
||||
{
|
||||
UploadAsyncCancelEventTest ((webClient, uri, cancelEvent) =>
|
||||
UploadAsyncCancelEventTest (9304,(webClient, uri, cancelEvent) =>
|
||||
{
|
||||
string tempFile = Path.Combine (_tempFolder, "upload.tmp");
|
||||
File.Create (tempFile).Close ();
|
||||
@@ -1845,6 +1852,7 @@ 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
|
||||
public void UploadFileAsyncContentType ()
|
||||
{
|
||||
var serverUri = "http://localhost:13370/";
|
||||
@@ -1868,10 +1876,10 @@ namespace MonoTests.System.Net
|
||||
#endif
|
||||
|
||||
#if NET_4_0
|
||||
public void UploadAsyncCancelEventTest (Action<WebClient, Uri, EventWaitHandle> uploadAction)
|
||||
public void UploadAsyncCancelEventTest (int port, Action<WebClient, Uri, EventWaitHandle> uploadAction)
|
||||
{
|
||||
var ep = new IPEndPoint (IPAddress.Loopback, 8000);
|
||||
string url = "http://" + IPAddress.Loopback + ":8000/test/";
|
||||
var ep = NetworkHelpers.LocalEphemeralEndPoint ();
|
||||
string url = "http://" + ep.ToString() + "/test/";
|
||||
|
||||
using (var responder = new SocketResponder (ep, EchoRequestHandler))
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace MonoTests.System.Net
|
||||
{
|
||||
[Test]
|
||||
[Category("Async")]
|
||||
[Category("AndroidNotWorking")] // Attempts to access the test dll which won't work on Android
|
||||
public void DownloadData ()
|
||||
{
|
||||
WebClient wc;
|
||||
@@ -94,6 +95,7 @@ namespace MonoTests.System.Net
|
||||
|
||||
[Test]
|
||||
[Category("InetAccess")]
|
||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||
public void Cancellation ()
|
||||
{
|
||||
WebClient wc = new WebClient ();
|
||||
@@ -121,6 +123,7 @@ namespace MonoTests.System.Net
|
||||
|
||||
[Test]
|
||||
[Category("InetAccess")]
|
||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||
public void DownloadMultiple ()
|
||||
{
|
||||
WebClient wc = new WebClient ();
|
||||
@@ -139,6 +142,7 @@ namespace MonoTests.System.Net
|
||||
|
||||
[Test]
|
||||
[Category("InetAccess")]
|
||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||
public void DownloadMultiple2 ()
|
||||
{
|
||||
WebClient wc = new WebClient ();
|
||||
@@ -151,6 +155,7 @@ namespace MonoTests.System.Net
|
||||
|
||||
[Test]
|
||||
[Category("InetAccess")]
|
||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||
public void DownloadMultiple3 ()
|
||||
{
|
||||
WebClient wc = new WebClient ();
|
||||
|
||||
@@ -316,6 +316,9 @@ 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")]
|
||||
public void TestFailedConnection ()
|
||||
{
|
||||
try {
|
||||
@@ -326,7 +329,7 @@ namespace MonoTests.System.Net {
|
||||
//#if NET_2_0 e.Message == "Unable to connect to the remote server"
|
||||
//#if NET_1_1 e.Message == "The underlying connection was closed: Unable to connect to the remote server."
|
||||
|
||||
Assert.AreEqual (((WebException)e).Status, WebExceptionStatus.ConnectFailure);
|
||||
Assert.AreEqual (WebExceptionStatus.ConnectFailure, ((WebException)e).Status);
|
||||
|
||||
//#if !NET_1_1 (this is not true in .NET 1.x)
|
||||
Assert.IsNotNull (e.InnerException);
|
||||
@@ -337,6 +340,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
|
||||
public void TestFailedResolution ()
|
||||
{
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user