[Mono-bugs] [Bug 62744][Nor] Changed - Only the last cookie sent from a remote HTTP server is available via HttpWebRequest.Cookies

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 13 Aug 2004 13:31:15 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by adam@battleaxe.net.

http://bugzilla.ximian.com/show_bug.cgi?id=62744

--- shadow/62744	2004-08-11 17:20:13.000000000 -0400
+++ shadow/62744.tmp.6807	2004-08-13 13:31:15.000000000 -0400
@@ -171,6 +171,36 @@
 SetInternal(string, string).  That's what I get for not sleeping.
 
 ------- Additional Comments From gonzalo@ximian.com  2004-08-11 17:20 -------
 Fixed in CVS HEAD.
 If there are no problems in the next week, I'll commit the fix to 1.0
 and close the bug.
+
+------- Additional Comments From adam@battleaxe.net  2004-08-13 13:31 -------
+There's still a slight problem with the fix.  If SetInternal gets
+called multiple times for the same header with the same value, you get
+messy results, such as "Connection: close,close".
+
+My hack to fix it:
+
+			if (IsMultiValue (name)) {
+				if (base [name] != null) {
+					string values = base.Get(name);
+					bool hasValue = false;
+					foreach (string v in values.Split (','))
+						if (v == value)
+						{
+							hasValue = true;
+							break;
+						}
+					if (!hasValue)
+						base.Add (name, value);
+				} else {
+					base.Add (name, value);
+				}
+			} else {
+				base.Remove (name);
+
+				base.Set (name, value);	
+
+			}
+