[#7637][Web]: Support empty write streams.

This commit is contained in:
Martin Baulig committed 2012-10-27 01:15:21 +02:00
1 parent b049dfb1a4
commit 1ccb01e108
2 files changed
+14 -2

No files matched your search

@@ -835,10 +835,10 @@ namespace System.Net
if (writeStream == null || writeStream.RequestWritten || !InternalAllowBuffering)
return;
#if NET_4_0
if (contentLength < 0 && writeStream.CanWrite == true && writeStream.WriteBufferLength <= 0)
if (contentLength < 0 && writeStream.CanWrite == true && writeStream.WriteBufferLength < 0)
return;
if (contentLength < 0 && writeStream.WriteBufferLength > 0)
if (contentLength < 0 && writeStream.WriteBufferLength >= 0)
InternalContentLength = writeStream.WriteBufferLength;
#else
if (contentLength < 0 && writeStream.CanWrite == true)
@@ -3158,6 +3158,18 @@ namespace MonoTests.System.Net
}
}
}
[Test]
// Bug6737
public void Post_EmptyRequestStream ()
{
var wr = HttpWebRequest.Create ("http://google.com");
wr.Method = "POST";
wr.GetRequestStream ();
var gr = wr.BeginGetResponse (delegate { }, null);
Assert.AreEqual (true, gr.AsyncWaitHandle.WaitOne (5000), "#1");
}
}
static class StreamExtensions {