Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@ -45,45 +45,45 @@ public class ServicePointTest
//WriteServicePoint ("A servicepoint that isn't really", p);
ServicePointManager.MaxServicePoints = 2;
ServicePoint google = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com"));
ServicePoint exampleCom = ServicePointManager.FindServicePoint (new Uri ("http://www.example.com"));
try {
ServicePoint slashdot = ServicePointManager.FindServicePoint (new Uri ("http://www.slashdot.org"));
ServicePoint exampleOrg = ServicePointManager.FindServicePoint (new Uri ("http://www.example.org"));
Assert.Fail ("#1");
} catch (InvalidOperationException) { }
ServicePointManager.MaxServicePoints = 0;
//WriteServicePoint ("google before getting a webrequest", google);
//WriteServicePoint ("example before getting a webrequest", example);
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.example.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");
//WriteServicePoint ("example after getting a response", example);
ServicePoint example2 = ServicePointManager.FindServicePoint (new Uri ("http://www.example.com/dilbert.html"));
Assert.AreEqual (example, example2, "#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...
HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
HttpWebRequest req2 = (HttpWebRequest) WebRequest.Create ("http://www.example.com");
req2.Method = "PUT";
IAsyncResult async = req2.BeginGetRequestStream (null, null);
//WriteServicePoint ("after async BeginGetRequestStream", google);
//WriteServicePoint ("after async BeginGetRequestStream", example);
// CurrentConnections: 1
Stream stream2 = req2.EndGetRequestStream (async);
//WriteServicePoint ("after async EndGetRequestStream", google);
//WriteServicePoint ("after async EndGetRequestStream", example);
// CurrentConnections: 1
stream2.Close ();
req2 = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
req2 = (HttpWebRequest) WebRequest.Create ("http://www.example.com");
async = req2.BeginGetResponse (null, null);
//WriteServicePoint ("after async BeginGetResponse", google);
//WriteServicePoint ("after async BeginGetResponse", example);
// CurrentConnections: 2
WebResponse res2 = req2.EndGetResponse (async);
//WriteServicePoint ("after async EndGetResponse", google);
//WriteServicePoint ("after async EndGetResponse", example);
// CurrentConnections: 0
// curious that after you get the webresponse object CurrentConnections is set to 0.
// you'd think that you'd still be connected until you close the webresponse..
@ -109,10 +109,10 @@ public class ServicePointTest
// what's the limit of the cache?
req2 = (HttpWebRequest) WebRequest.Create ("http://www.apache.org/");
req2 = (HttpWebRequest) WebRequest.Create ("http://www.example.org/");
res2 = req2.GetResponse ();
sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.apache.org/"));
//WriteServicePoint ("apache", sp2);
sp2 = ServicePointManager.FindServicePoint (new Uri("http://www.example.org/"));
//WriteServicePoint ("example", sp2);
//Console.WriteLine ("ContentLength: " + res2.ContentLength);
// CurrentConnections: 1
res2.Close ();
@ -130,7 +130,7 @@ public class ServicePointTest
// the default is already 2, just in case it isn't..
ServicePointManager.DefaultConnectionLimit = 5;
Uri uri = new Uri ("http://www.go-mono.com/");
Uri uri = new Uri ("http://www.example.com/");
ServicePoint sp = ServicePointManager.FindServicePoint (uri);
WebResponse [] res = new WebResponse [5];
for (int i = 0; i < 5; i++) {
@ -159,7 +159,7 @@ public class ServicePointTest
[Category ("NotWorking")] // #A1 fails
public void EndPointBind ()
{
Uri uri = new Uri ("http://www.go-mono.com/");
Uri uri = new Uri ("http://www.example.com/");
ServicePoint sp = ServicePointManager.FindServicePoint (uri);
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);