2004-10-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 5 Oct 2004 01:54:16 +0000 (01:54 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 5 Oct 2004 01:54:16 +0000 (01:54 -0000)
* HttpWebRequest.cs: use RemoveAndAdd for headers multivalue headers.
* WebHeaderCollection.cs: added RemoveAndAdd that behaves like the old
SetInternal.

svn path=/branches/mono-1-0/mcs/; revision=34699

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

index 8cc9ef5541be2cc7c9e2730d5f2b817302b74944..94166c8508a46eb3d0ee9214cac8690beb8f5454 100644 (file)
        * WebConnection.cs: setup the tunnled connection when using a proxy and
        https.
 
+2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpWebRequest.cs: ProxyQuery returns true when we use a proxy without
+       tunneling a secure connection.
+
+       * ServicePoint.cs: added UseConnect property.
+
+       * ServicePointManager.cs: set the UseConnect property when we use a http
+       proxy for a https connection.
+
+       * WebConnection.cs: setup the tunnled connection when using a proxy and
+       https.
+
 2004-09-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * HttpWebResponse.cs: remove unused SplitValue method.
index f3962f472d8428f0424c11df2324cbf7525264d8..9da3708dadf411e6e436bd322934fd3ebd427346 100644 (file)
@@ -147,7 +147,7 @@ namespace System.Net
                        get { return webHeaders ["Accept"]; }
                        set {
                                CheckRequestStarted ();
-                               webHeaders.SetInternal ("Accept", value);
+                               webHeaders.RemoveAndAdd ("Accept", value);
                        }
                }
                
@@ -199,7 +199,7 @@ namespace System.Net
                                if (keepAlive && val.IndexOf ("keep-alive") == -1)
                                        value = value + ", Keep-Alive";
                                
-                               webHeaders.SetInternal ("Connection", value);
+                               webHeaders.RemoveAndAdd ("Connection", value);
                        }
                }               
                
@@ -231,7 +231,7 @@ namespace System.Net
                                        webHeaders.RemoveInternal ("Content-Type");
                                        return;
                                }
-                               webHeaders.SetInternal ("Content-Type", value);
+                               webHeaders.RemoveAndAdd ("Content-Type", value);
                        }
                }
                
@@ -266,7 +266,7 @@ namespace System.Net
                                if (val == "100-continue")
                                        throw new ArgumentException ("100-Continue cannot be set with this property.",
                                                                     "value");
-                               webHeaders.SetInternal ("Expect", value);
+                               webHeaders.RemoveAndAdd ("Expect", value);
                        }
                }
                
@@ -452,7 +452,7 @@ namespace System.Net
                                if (!sendChunked)
                                        throw new ArgumentException ("SendChunked must be True", "value");
 
-                               webHeaders.SetInternal ("Transfer-Encoding", value);
+                               webHeaders.RemoveAndAdd ("Transfer-Encoding", value);
                        }
                }
                
@@ -852,13 +852,13 @@ namespace System.Net
                                webHeaders.RemoveInternal ("Transfer-Encoding");
                        } else if (sendChunked) {
                                continue100 = true;
-                               webHeaders.SetInternal ("Transfer-Encoding", "chunked");
+                               webHeaders.RemoveAndAdd ("Transfer-Encoding", "chunked");
                                webHeaders.RemoveInternal ("Content-Length");
                        }
 
                        if (actualVersion == HttpVersion.Version11 && continue100 &&
                            servicePoint.SendContinue) { // RFC2616 8.2.3
-                               webHeaders.SetInternal ("Expect" , "100-continue");
+                               webHeaders.RemoveAndAdd ("Expect" , "100-continue");
                                expectContinue = true;
                        } else {
                                webHeaders.RemoveInternal ("Expect");
@@ -871,9 +871,9 @@ namespace System.Net
                                         servicePoint.ProtocolVersion == HttpVersion.Version10);
 
                        if (keepAlive && (version == HttpVersion.Version10 || spoint10)) {
-                               webHeaders.SetInternal (connectionHeader, "keep-alive");
+                               webHeaders.RemoveAndAdd (connectionHeader, "keep-alive");
                        } else if (!keepAlive && version == HttpVersion.Version11) {
-                               webHeaders.SetInternal (connectionHeader, "close");
+                               webHeaders.RemoveAndAdd (connectionHeader, "close");
                        }
 
                        webHeaders.SetInternal ("Host", actualUri.Authority);
@@ -947,6 +947,7 @@ namespace System.Net
                        req.Append (GetHeaders ());
                        string reqstr = req.ToString ();
                        byte [] bytes = Encoding.UTF8.GetBytes (reqstr);
+                       Console.WriteLine (reqstr);
                        writeStream.SetHeaders (bytes, 0, bytes.Length);
                }
 
index f41105bd5bcc5aef063dfe373f87957e550abcb8..4d3c29db3cd42e663a8df9dcc8855fdd9c83f6a6 100644 (file)
@@ -267,7 +267,18 @@ namespace System.Net
                                base.Set (name, value); \r
                        }
                }\r
-               \r
+
+               internal void RemoveAndAdd (string name, string value)
+               {
+                       if (value == null)
+                               value = String.Empty;
+                       else
+                               value = value.Trim ();
+
+                       base.Remove (name);
+                       base.Set (name, value);
+               }
+
                internal void RemoveInternal (string name)\r
                {\r
                        if (name == null)\r