* HttpWebRequest.cs: avoid duplicating Accept-Encoding if GetHeaders()
is called twice.
* WebConnectionStream.cs: don't send a 0 content length for non-write
requests.
svn path=/trunk/mcs/; revision=137233
+2009-07-02 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+ * HttpWebRequest.cs: avoid duplicating Accept-Encoding if GetHeaders()
+ is called twice.
+ * WebConnectionStream.cs: don't send a 0 content length for non-write
+ requests.
+
2009-07-02 Gonzalo Paniagua Javier <gonzalo@novell.com>
* WebConnection.cs: must use the 'int' version in 1.1.
if ((auto_decomp & DecompressionMethods.Deflate) != 0)
accept_encoding = accept_encoding != null ? "gzip, deflate" : "deflate";
if (accept_encoding != null)
- webHeaders.SetInternal ("Accept-Encoding", accept_encoding);
+ webHeaders.RemoveAndAdd ("Accept-Encoding", accept_encoding);
#endif
if (!usedPreAuth && preAuthenticate)
DoPreAuthenticate ();
}
if (!headersSent) {
- request.InternalContentLength = length;
+ bool no_writestream = (method == "GET" || method == "CONNECT" || method == "HEAD" ||
+ method == "TRACE" || method == "DELETE");
+ if (!no_writestream)
+ request.InternalContentLength = length;
request.SendRequestHeaders ();
}
WriteHeaders ();