Browse Source

2009-07-02 Gonzalo Paniagua Javier <[email protected]>

	* 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
Gonzalo Paniagua Javier 16 years ago
parent
commit
7ff2c1978d

+ 7 - 0
mcs/class/System/System.Net/ChangeLog

@@ -1,3 +1,10 @@
+2009-07-02 Gonzalo Paniagua Javier <[email protected]>
+
+	* 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 <[email protected]>
 
 	* WebConnection.cs: must use the 'int' version in 1.1.

+ 1 - 1
mcs/class/System/System.Net/HttpWebRequest.cs

@@ -1043,7 +1043,7 @@ namespace System.Net
 			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 ();

+ 4 - 1
mcs/class/System/System.Net/WebConnectionStream.cs

@@ -680,7 +680,10 @@ namespace System.Net
 			}
 
 			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 ();