Author: gonzalo
Date: 2005-03-30 21:32:49 -0500 (Wed, 30 Mar 2005)
New Revision: 42411

Modified:
   trunk/mcs/class/System/System.Net/ChangeLog
   trunk/mcs/class/System/System.Net/CookieCollection.cs
   trunk/mcs/class/System/System.Net/CookieContainer.cs
   trunk/mcs/class/System/System.Net/HttpWebRequest.cs
   trunk/mcs/class/System/System.Net/HttpWebResponse.cs
Log:
2005-03-30 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * CookieContainer.cs: adding to a CookieCollection might not increment
        the number of items if the cookie is replaced. Now Count works properly.
        Fixed an array index exception (typo).

        * CookieCollection.cs: also compare the version.

        * HttpWebResponse.cs: when we have cookies, add them to the request
        container.

        * HttpWebRequest.cs: changed last parameter of HttpWebResponse ctor.



Modified: trunk/mcs/class/System/System.Net/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net/ChangeLog 2005-03-31 01:54:52 UTC (rev 
42410)
+++ trunk/mcs/class/System/System.Net/ChangeLog 2005-03-31 02:32:49 UTC (rev 
42411)
@@ -1,3 +1,16 @@
+2005-03-30 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * CookieContainer.cs: adding to a CookieCollection might not increment
+       the number of items if the cookie is replaced. Now Count works properly.
+       Fixed an array index exception (typo).
+
+       * CookieCollection.cs: also compare the version.
+
+       * HttpWebResponse.cs: when we have cookies, add them to the request
+       container.
+
+       * HttpWebRequest.cs: changed last parameter of HttpWebResponse ctor.
+
 2005-03-30  Miguel de Icaza  <[EMAIL PROTECTED]>
 
        * Cookie.cs: Compare using the InvariantCulture, to match the

Modified: trunk/mcs/class/System/System.Net/CookieCollection.cs
===================================================================
--- trunk/mcs/class/System/System.Net/CookieCollection.cs       2005-03-31 
01:54:52 UTC (rev 42410)
+++ trunk/mcs/class/System/System.Net/CookieCollection.cs       2005-03-31 
02:32:49 UTC (rev 42411)
@@ -82,7 +82,7 @@
                        int pos = SearchCookie (cookie);
                        if (pos == -1)
                                list.Add (cookie);
-                       else 
+                       else
                                list [pos] = cookie;
                }
 
@@ -94,6 +94,9 @@
 
                        for (int i = list.Count - 1; i >= 0; i--) {
                                Cookie c = (Cookie) list [i];
+                               if (c.Version != cookie.Version)
+                                       continue;
+
                                if (0 != String.Compare (domain, c.Domain, 
true, CultureInfo.InvariantCulture))
                                        continue;
 

Modified: trunk/mcs/class/System/System.Net/CookieContainer.cs
===================================================================
--- trunk/mcs/class/System/System.Net/CookieContainer.cs        2005-03-31 
01:54:52 UTC (rev 42410)
+++ trunk/mcs/class/System/System.Net/CookieContainer.cs        2005-03-31 
02:32:49 UTC (rev 42411)
@@ -140,7 +140,7 @@
                                        throw new CookieException ("Capacity 
exceeded");
 
                                cookies.Add (cookie);
-                               count++;
+                               count = cookies.Count;
                        }
                }
 
@@ -265,7 +265,7 @@
                                                        continue;
 
                                                if (path [path.Length - 1] != 
'/' && uripath.Length > path.Length &&
-                                                   path [path.Length] != '/')
+                                                   uripath [path.Length] != 
'/')
                                                        continue;
                                        }
                                }

Modified: trunk/mcs/class/System/System.Net/HttpWebRequest.cs
===================================================================
--- trunk/mcs/class/System/System.Net/HttpWebRequest.cs 2005-03-31 01:54:52 UTC 
(rev 42410)
+++ trunk/mcs/class/System/System.Net/HttpWebRequest.cs 2005-03-31 02:32:49 UTC 
(rev 42411)
@@ -1023,7 +1023,7 @@
 
                        WebException wexc = null;
                        try {
-                               webResponse = new HttpWebResponse (actualUri, 
method, data, (cookieContainer != null));
+                               webResponse = new HttpWebResponse (actualUri, 
method, data, cookieContainer);
                                haveResponse = true;
                        } catch (Exception e) {
                                wexc = new WebException (e.Message, e, 
WebExceptionStatus.ProtocolError, null); 

Modified: trunk/mcs/class/System/System.Net/HttpWebResponse.cs
===================================================================
--- trunk/mcs/class/System/System.Net/HttpWebResponse.cs        2005-03-31 
01:54:52 UTC (rev 42410)
+++ trunk/mcs/class/System/System.Net/HttpWebResponse.cs        2005-03-31 
02:32:49 UTC (rev 42411)
@@ -52,13 +52,14 @@
                string statusDescription;
                long contentLength = -1;
                string contentType;
+               CookieContainer cookieContainer;
 
                bool disposed = false;
                Stream stream;
                
                // Constructors
                
-               internal HttpWebResponse (Uri uri, string method, 
WebConnectionData data, bool cookiesSet)
+               internal HttpWebResponse (Uri uri, string method, 
WebConnectionData data, CookieContainer container)
                {
                        this.uri = uri;
                        this.method = method;
@@ -67,7 +68,8 @@
                        statusCode = (HttpStatusCode) data.StatusCode;
                        statusDescription = data.StatusDescription;
                        stream = data.stream;
-                       if (cookiesSet) {
+                       if (container != null) {
+                               this.cookieContainer = container;
                                FillCookies ();
                        } else if (webHeaders != null) {
                                webHeaders.RemoveInternal ("Set-Cookie");
@@ -408,6 +410,8 @@
                                cookie.Domain = uri.Host;
 
                        cookieCollection.Add (cookie);
+                       if (cookieContainer != null)
+                               cookieContainer.Add (uri, cookie);
                }
 
                void SetCookie2 (string cookies_str)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to