Imported Upstream version 5.2.0.175

Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-06-07 13:16:24 +00:00
parent 4bdbaf4a88
commit 966bba02bb
8776 changed files with 346420 additions and 149650 deletions

View File

@@ -97,6 +97,8 @@ namespace System.Net {
stream = ssl_stream.AuthenticatedStream;
}
timer = new Timer (OnTimeout, null, Timeout.Infinite, Timeout.Infinite);
if (ssl_stream != null)
ssl_stream.AuthenticateAsServer (cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false);
Init ();
}
@@ -110,10 +112,6 @@ namespace System.Net {
void Init ()
{
if (ssl_stream != null) {
ssl_stream.AuthenticateAsServer (cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false);
}
context_bound = false;
i_stream = null;
o_stream = null;

View File

@@ -404,7 +404,7 @@ namespace System.Net {
}
public long ContentLength64 {
get { return content_length; }
get { return is_chunked ? -1 : content_length; }
}
public string ContentType {

View File

@@ -1031,9 +1031,9 @@ namespace System.Net
return result.Response;
}
public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext transportContext)
public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext context)
{
transportContext = null;
context = null;
return EndGetRequestStream (asyncResult);
}

View File

@@ -86,10 +86,14 @@ namespace System.Net
}
string content_encoding = webHeaders ["Content-Encoding"];
if (content_encoding == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != 0)
if (content_encoding == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != 0) {
stream = new GZipStream (stream, CompressionMode.Decompress);
else if (content_encoding == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != 0)
webHeaders.Remove (HttpRequestHeader.ContentEncoding);
}
else if (content_encoding == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) {
stream = new DeflateStream (stream, CompressionMode.Decompress);
webHeaders.Remove (HttpRequestHeader.ContentEncoding);
}
}
[Obsolete ("Serialization is obsoleted for this type", false)]

View File

@@ -99,19 +99,26 @@ namespace System.Net {
if (start_host >= length)
throw new ArgumentException ("No host specified.");
int colon = uri.IndexOf (':', start_host, length - start_host);
int root;
if (colon > 0) {
host = uri.Substring (start_host, colon - start_host);
root = uri.IndexOf ('/', colon, length - colon);
port = (ushort) Int32.Parse (uri.Substring (colon + 1, root - colon - 1));
path = uri.Substring (root);
} else {
root = uri.IndexOf ('/', start_host, length - start_host);
host = uri.Substring (start_host, root - start_host);
port = default_port;
path = uri.Substring (root);
int startPort = uri.IndexOf (':', start_host, length - start_host);
if (uri [start_host] == '[') {
startPort = uri.IndexOf ("]:") + 1;
}
if (start_host == startPort)
throw new ArgumentException ("No host specified.");
int root = uri.IndexOf ('/', start_host, length - start_host);
if (root == -1)
throw new ArgumentException ("No path specified.");
if (startPort > 0) {
host = uri.Substring (start_host, startPort - start_host).Trim ('[', ']');
port = UInt16.Parse (uri.Substring (startPort + 1, root - startPort - 1));
} else {
host = uri.Substring (start_host, root - start_host).Trim ('[', ']');
port = default_port;
}
path = uri.Substring (root);
if (path.Length != 1)
path = path.Substring (0, path.Length - 1);
}
@@ -121,7 +128,7 @@ namespace System.Net {
if (uri == null)
throw new ArgumentNullException ("uriPrefix");
if(!uri.StartsWith ("http://") && !uri.StartsWith ("https://"))
if (!uri.StartsWith ("http://") && !uri.StartsWith ("https://"))
throw new ArgumentException ("Only 'http' and 'https' schemes are supported.");
int length = uri.Length;
@@ -129,27 +136,23 @@ namespace System.Net {
if (start_host >= length)
throw new ArgumentException ("No host specified.");
int colon = uri.IndexOf (':', start_host, length - start_host);
if (start_host == colon)
int startPort = uri.IndexOf (':', start_host, length - start_host);
if (uri [start_host] == '[')
startPort = uri.IndexOf ("]:") + 1;
if (start_host == startPort)
throw new ArgumentException ("No host specified.");
int root = uri.IndexOf ('/', start_host, length - start_host);
if (root == -1)
throw new ArgumentException ("No path specified.");
int root;
if (colon > 0) {
root = uri.IndexOf ('/', colon, length - colon);
if (root == -1)
throw new ArgumentException ("No path specified.");
if (startPort > 0) {
try {
int p = Int32.Parse (uri.Substring (colon + 1, root - colon - 1));
int p = Int32.Parse (uri.Substring (startPort + 1, root - startPort - 1));
if (p <= 0 || p >= 65536)
throw new Exception ();
} catch {
throw new ArgumentException ("Invalid port.");
}
} else {
root = uri.IndexOf ('/', start_host, length - start_host);
if (root == -1)
throw new ArgumentException ("No path specified.");
}
if (uri [uri.Length - 1] != '/')
@@ -158,4 +161,3 @@ namespace System.Net {
}
}
#endif

View File

@@ -29,7 +29,7 @@ using System.Net;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using ObjCRuntime;
using ObjCRuntimeInternal;
namespace Mono.Net
{