Imported Upstream version 4.2.0.179

Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent aa7da660d6
commit c042cd0c52
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -56,8 +56,6 @@ namespace System.Net {
static Dns ()
{
System.Net.Sockets.Socket.CheckProtocolSupport();
#if !MOBILE
if (Environment.GetEnvironmentVariable ("MONO_DNS") != null) {
resolver = new SimpleResolver ();

View File

@@ -162,7 +162,7 @@ namespace System.Net {
string path;
Uri raw_uri = null;
if (Uri.MaybeUri (raw_url) && Uri.TryCreate (raw_url, UriKind.Absolute, out raw_uri))
if (Uri.MaybeUri (raw_url.ToLowerInvariant ()) && Uri.TryCreate (raw_url, UriKind.Absolute, out raw_uri))
path = raw_uri.PathAndQuery;
else
path = raw_url;
@@ -188,6 +188,11 @@ namespace System.Net {
CreateQueryString (url.Query);
// Use reference source HttpListenerRequestUriBuilder to process url.
// Fixes #29927
url = HttpListenerRequestUriBuilder.GetRequestUri (raw_url, url.Scheme,
url.Authority, url.LocalPath, url.Query);
if (version >= HttpVersion.Version11) {
string t_encoding = Headers ["Transfer-Encoding"];
is_chunked = (t_encoding != null && String.Compare (t_encoding, "chunked", StringComparison.OrdinalIgnoreCase) == 0);

View File

@@ -1110,7 +1110,7 @@ namespace System.Net
if (e != null)
throw e;
if (AllowWriteStreamBuffering)
if (AllowWriteStreamBuffering || method == "GET")
contentLength = -1;
uriString = webResponse.Headers ["Location"];

View File

@@ -275,7 +275,7 @@ namespace System.Net
groups.Remove (group.Name);
}
internal bool CheckAvailableForRecycling (out DateTime outIdleSince)
bool CheckAvailableForRecycling (out DateTime outIdleSince)
{
outIdleSince = DateTime.MinValue;
@@ -312,7 +312,7 @@ namespace System.Net
lock (this) {
idleSince = outIdleSince;
if (removeList != null) {
if (removeList != null && groups != null) {
foreach (var group in removeList)
if (groups.ContainsKey (group.Name))
RemoveConnectionGroup (group);
@@ -401,14 +401,21 @@ namespace System.Net
}
public bool CloseConnectionGroup (string connectionGroupName)
{
WebConnectionGroup cncGroup = null;
lock (this) {
WebConnectionGroup cncGroup = GetConnectionGroup (connectionGroupName);
cncGroup = GetConnectionGroup (connectionGroupName);
if (cncGroup != null) {
cncGroup.Close ();
return true;
RemoveConnectionGroup (cncGroup);
}
}
// WebConnectionGroup.Close() must *not* be called inside the lock
if (cncGroup != null) {
cncGroup.Close ();
return true;
}
return false;
}

View File

@@ -106,7 +106,7 @@ namespace System.Net
#if MONOTOUCH
[System.Runtime.InteropServices.DllImport ("__Internal")]
static extern void monotouch_start_wwan (string uri);
static extern void xamarin_start_wwan (string uri);
#endif
internal ChunkStream ChunkStream {
@@ -171,7 +171,7 @@ namespace System.Net
if (hostEntry == null) {
#if MONOTOUCH
monotouch_start_wwan (sPoint.Address.ToString ());
xamarin_start_wwan (sPoint.Address.ToString ());
hostEntry = sPoint.HostEntry;
if (hostEntry == null) {
#endif
@@ -1067,6 +1067,8 @@ namespace System.Net
Stream s = null;
lock (this) {
if (status == WebExceptionStatus.RequestCanceled)
return true;
if (Data.request != request)
throw new ObjectDisposedException (typeof (NetworkStream).FullName);
if (nstream == null)

View File

@@ -66,6 +66,8 @@ namespace System.Net
public void Close ()
{
List<WebConnection> connectionsToClose = null;
//TODO: what do we do with the queue? Empty it out and abort the requests?
//TODO: abort requests or wait for them to finish
lock (sPoint) {
@@ -76,7 +78,17 @@ namespace System.Net
var node = iter;
iter = iter.Next;
// Closing connections inside the lock leads to a deadlock.
if (connectionsToClose == null)
connectionsToClose = new List<WebConnection>();
connectionsToClose.Add (cnc);
connections.Remove (node);
}
}
if (connectionsToClose != null) {
foreach (var cnc in connectionsToClose) {
cnc.Close (false);
OnConnectionClosed ();
}

View File

@@ -654,7 +654,8 @@ namespace System.Net
if (setInternalLength && !no_writestream && writeBuffer != null)
request.InternalContentLength = writeBuffer.Length;
if (!(sendChunked || request.ContentLength > -1 || no_writestream || webdav))
bool has_content = !no_writestream && (writeBuffer == null || request.ContentLength > -1);
if (!(sendChunked || has_content || no_writestream || webdav))
return false;
headersSent = true;