[System]: Fix WebConnectionStream.SetHeadersAsync() logic for #31830.
authorMartin Baulig <martin.baulig@xamarin.com>
Thu, 30 Jul 2015 13:28:28 +0000 (15:28 +0200)
committerMartin Baulig <martin.baulig@xamarin.com>
Thu, 30 Jul 2015 13:41:10 +0000 (15:41 +0200)
This fixes commits 8ccfe0f8ff71d18151f8aad90d0855dfd2d2a723 and
c109f9ca03d38e608cbd85cb2fdf8cfaf55bb97c.

Added new test:
https://github.com/xamarin/web-tests/commit/d60bc3f637ca2bf4aa1379b839d878e224d344c8

(cherry picked from commit c133880bc407baed5d46222e20677d1427b32b4d)

mcs/class/System/System.Net/WebConnectionStream.cs

index 87f60363da8a4306b543420ccf085a142b764d2e..3862b3e4eff56284f11f2d1f768ce139c75e2c02 100644 (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;