Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@xamarin.com>2015-09-14 16:04:35 +0300
committerSebastien Pouliot <sebastien@xamarin.com>2015-09-14 16:04:35 +0300
commit751e0fa359b55a3dcdf32ab635987facae8258dc (patch)
treebd7813659738c0b71be1b6278cc3b5baed906f4f
parent07e600d6695292e8d3c8c9843b4c32852dea2b04 (diff)
parent5ab4c0d099a69de2a2ef5d1cf8d83e78df4d6af8 (diff)
Merge branch 'mono-4.0.0-branch-c5sr4' into xcode7-c5xcode7-c5
-rw-r--r--configure.ac2
-rw-r--r--mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs2
-rw-r--r--mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs6
-rw-r--r--mcs/class/System/System.Net/HttpWebRequest.cs44
-rw-r--r--mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs35
-rw-r--r--mono/metadata/image.c5
-rw-r--r--mono/mini/seq-points.c10
-rw-r--r--support/zlib-helper.c4
-rw-r--r--winconfig.h2
9 files changed, 93 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index eb6b931cec5..4d5ca3baf19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
-AC_INIT(mono, [4.0.3],
+AC_INIT(mono, [4.0.4],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs
index 513a21eb5db..5c23fc0b525 100644
--- a/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs
+++ b/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs
@@ -340,6 +340,8 @@ namespace System.Net.Http
wrequest.ContentLength = content.Headers.ContentLength.Value;
}
+ wrequest.ResendContentFactory = content.CopyTo;
+
var stream = await wrequest.GetRequestStreamAsync ().ConfigureAwait (false);
await request.Content.CopyToAsync (stream).ConfigureAwait (false);
} else if (HttpMethod.Post.Equals (request.Method) || HttpMethod.Put.Equals (request.Method) || HttpMethod.Delete.Equals (request.Method)) {
diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs
index 344d87164eb..df97dc50bbc 100644
--- a/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs
+++ b/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs
@@ -81,6 +81,12 @@ namespace System.Net.Http
}
}
+ // Only used by HttpWebRequest internals which is not async friendly
+ internal void CopyTo (Stream stream)
+ {
+ CopyToAsync (stream).Wait ();
+ }
+
public Task CopyToAsync (Stream stream)
{
return CopyToAsync (stream, null);
diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs
index 7ccbcc2f34e..fc30c3ad9be 100644
--- a/mcs/class/System/System.Net/HttpWebRequest.cs
+++ b/mcs/class/System/System.Net/HttpWebRequest.cs
@@ -110,6 +110,9 @@ namespace System.Net
AuthorizationState auth_state, proxy_auth_state;
string host;
+ [NonSerialized]
+ internal Action<Stream> ResendContentFactory;
+
// Constructors
static HttpWebRequest ()
{
@@ -226,9 +229,15 @@ namespace System.Net
internal bool InternalAllowBuffering {
get {
- return (allowBuffering && (method != "HEAD" && method != "GET" &&
- method != "MKCOL" && method != "CONNECT" &&
- method != "TRACE"));
+ return allowBuffering && MethodWithBuffer;
+ }
+ }
+
+ bool MethodWithBuffer {
+ get {
+ return method != "HEAD" && method != "GET" &&
+ method != "MKCOL" && method != "CONNECT" &&
+ method != "TRACE";
}
}
@@ -1306,8 +1315,7 @@ namespace System.Net
bodyBuffer = null;
writeStream.Close ();
}
- } else if (method != "HEAD" && method != "GET" && method != "MKCOL" && method != "CONNECT" &&
- method != "TRACE") {
+ } else if (MethodWithBuffer) {
if (getResponseCalled && !writeStream.RequestWritten)
return writeStream.WriteRequestAsync (result);
}
@@ -1606,12 +1614,28 @@ namespace System.Net
(ProxyQuery && !proxy_auth_state.IsCompleted && code == HttpStatusCode.ProxyAuthenticationRequired)) {
if (!usedPreAuth && CheckAuthorization (webResponse, code)) {
// Keep the written body, so it can be rewritten in the retry
- if (InternalAllowBuffering) {
- if (writeStream.WriteBufferLength > 0) {
- bodyBuffer = writeStream.WriteBuffer;
- bodyBufferLength = writeStream.WriteBufferLength;
+ if (MethodWithBuffer) {
+ if (AllowWriteStreamBuffering) {
+ if (writeStream.WriteBufferLength > 0) {
+ bodyBuffer = writeStream.WriteBuffer;
+ bodyBufferLength = writeStream.WriteBufferLength;
+ }
+
+ return true;
+ }
+
+ //
+ // Buffering is not allowed but we have alternative way to get same content (we
+ // need to resent it due to NTLM Authentication).
+ //
+ if (ResendContentFactory != null) {
+ using (var ms = new MemoryStream ()) {
+ ResendContentFactory (ms);
+ bodyBuffer = ms.ToArray ();
+ bodyBufferLength = bodyBuffer.Length;
+ }
+ return true;
}
- return true;
} else if (method != "PUT" && method != "POST") {
bodyBuffer = null;
return true;
diff --git a/mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs b/mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs
index 984d13ca93d..1df962bffbb 100644
--- a/mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs
+++ b/mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs
@@ -362,6 +362,41 @@ namespace MonoTests.System.IO.Compression
backing.Close();
}
#endif
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void CheckBufferOverrun ()
+ {
+ byte[] data = new byte [20];
+ MemoryStream backing = new MemoryStream ();
+ DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
+ compressing.Write (data, 0, data.Length + 1);
+ compressing.Close ();
+ backing.Close ();
+ }
+
+ [Test]
+ public void Bug28777_EmptyFlush ()
+ {
+ MemoryStream backing = new MemoryStream ();
+ DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
+ compressing.Flush ();
+ compressing.Close ();
+ backing.Close ();
+ }
+
+ [Test]
+ public void Bug28777_DoubleFlush ()
+ {
+ byte[] buffer = new byte [4096];
+ MemoryStream backing = new MemoryStream ();
+ DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
+ compressing.Write (buffer, 0, buffer.Length);
+ compressing.Flush ();
+ compressing.Flush ();
+ compressing.Close ();
+ backing.Close ();
+ }
}
}
diff --git a/mono/metadata/image.c b/mono/metadata/image.c
index d62b7036d84..90768b70e0f 100644
--- a/mono/metadata/image.c
+++ b/mono/metadata/image.c
@@ -2007,6 +2007,7 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx)
mono_image_unlock (image);
return image->files [fileidx - 1];
}
+ mono_image_unlock (image);
fname_id = mono_metadata_decode_row_col (t, fileidx - 1, MONO_FILE_NAME);
fname = mono_metadata_string_heap (image, fname_id);
@@ -2020,7 +2021,7 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx)
if (image->files && image->files [fileidx - 1]) {
MonoImage *old = res;
res = image->files [fileidx - 1];
- mono_loader_unlock ();
+ mono_image_unlock (image);
mono_image_close (old);
} else {
int i;
@@ -2034,7 +2035,7 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx)
if (!image->files)
image->files = g_new0 (MonoImage*, t->rows);
image->files [fileidx - 1] = res;
- mono_loader_unlock ();
+ mono_image_unlock (image);
/* vtable fixup can't happen with the image lock held */
#ifdef HOST_WIN32
if (res->is_module_handle)
diff --git a/mono/mini/seq-points.c b/mono/mini/seq-points.c
index 18a3f27384b..b58e81b34d2 100644
--- a/mono/mini/seq-points.c
+++ b/mono/mini/seq-points.c
@@ -398,14 +398,20 @@ MonoSeqPointInfo*
get_seq_points (MonoDomain *domain, MonoMethod *method)
{
MonoSeqPointInfo *seq_points;
+ MonoMethod *declaring_generic_method = NULL, *shared_method = NULL;
+
+ if (method->is_inflated) {
+ declaring_generic_method = mono_method_get_declaring_generic_method (method);
+ shared_method = mini_get_shared_method (method);
+ }
mono_domain_lock (domain);
seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, method);
if (!seq_points && method->is_inflated) {
/* generic sharing + aot */
- seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, mono_method_get_declaring_generic_method (method));
+ seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, declaring_generic_method);
if (!seq_points)
- seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, mini_get_shared_method (method));
+ seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, shared_method);
}
mono_domain_unlock (domain);
diff --git a/support/zlib-helper.c b/support/zlib-helper.c
index 83455413b36..38696260a09 100644
--- a/support/zlib-helper.c
+++ b/support/zlib-helper.c
@@ -90,6 +90,8 @@ CreateZStream (gint compress, guchar gzip, read_write_func func, void *gchandle)
result->gchandle = gchandle;
result->compress = compress;
result->buffer = g_new (guchar, BUFFER_SIZE);
+ result->stream->next_out = result->buffer;
+ result->stream->avail_out = BUFFER_SIZE;
return result;
}
@@ -148,7 +150,7 @@ flush_internal (ZStream *stream, gboolean is_final)
if (!stream->compress)
return 0;
- if (!is_final) {
+ if (!is_final && stream->stream->avail_in != 0) {
status = deflate (stream->stream, Z_PARTIAL_FLUSH);
if (status != Z_OK && status != Z_STREAM_END)
return status;
diff --git a/winconfig.h b/winconfig.h
index 840060e59f7..eb140e1c9d9 100644
--- a/winconfig.h
+++ b/winconfig.h
@@ -642,5 +642,5 @@
/* #undef USE_MONO_MUTEX */
/* Version number of package */
-#define VERSION "4.0.3"
+#define VERSION "4.0.4"
#endif