[System]: Fix WebConnectionStream.SetHeadersAsync() logic for #31830.
[mono.git] / 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;