2009-07-02 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 2 Jul 2009 07:33:12 +0000 (07:33 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 2 Jul 2009 07:33:12 +0000 (07:33 -0000)
* 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

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

index 8acc2e07e7081d79ee03184d72e66355244a54fe..3629fb0b92eec3d0b6dc72c45b5b5b8b01d6e6e8 100644 (file)
@@ -1,3 +1,10 @@
+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.
index 7f2e805b22a68cd81af0a7435398bf87f1fb4abb..70426744fdca105c631ba829f87cd62a86a8de2e 100644 (file)
@@ -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 ();
index 60aa236357d8785504847e3dddb0adf7a0bbc227..800901d8d7d43a338a48ae0b80b46641b3a55c1c 100644 (file)
@@ -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 ();