2003-07-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 8 Jul 2003 01:14:40 +0000 (01:14 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Tue, 8 Jul 2003 01:14:40 +0000 (01:14 -0000)
* System.Web/HttpContext.cs: Session doesn't have a setter.

* System.Web/HttpResponse.cs: Request is private.

* System.Web.SessionState/SessionDictionary.cs: locking.

* System.Web.SessionState/SessionInProcHandler.cs: use the new method
instead of the setter.

svn path=/trunk/mcs/; revision=16029

mcs/class/System.Web/System.Web.SessionState/ChangeLog
mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs
mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpContext.cs
mcs/class/System.Web/System.Web/HttpResponse.cs

index ddf6f1bd620bd394f15854b8c0f081e456317af6..1d29f3886e788ea3e208ed025e886b882eec87ad 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-08  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * SessionDictionary.cs: locking.
+
+       * SessionInProcHandler.cs: use the new method instead of the setter.
+
 2003-07-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * ISessionHandler.cs:
index 8a916d08fbf7bd3be075af50b9a188936b477f56..a0bf55195cfd0e31f5e50d842154f0a16e61d176 100644 (file)
@@ -46,12 +46,17 @@ internal class SessionDictionary : NameObjectCollectionBase
        internal void Clear ()
        {
                _dirty = true;
-               BaseClear ();
+               lock (this)
+                       BaseClear ();
        }
 
        internal string GetKey (int index)
        {
-               return BaseGetKey (index);
+               string value;
+               lock (this)
+                       value = BaseGetKey (index);
+                       
+               return value;
        }
 
        internal static bool IsInmutable (object o)
@@ -62,28 +67,32 @@ internal class SessionDictionary : NameObjectCollectionBase
 
        internal void Remove (string s)
        {
-               BaseRemove (s);
+               lock (this)
+                       BaseRemove (s);
                _dirty = true;
        }
 
        internal void RemoveAt (int index)
        {
-               BaseRemoveAt (index);
+               lock (this)
+                       BaseRemoveAt (index);
                _dirty = true;
        }
 
        internal void Serialize (BinaryWriter w)
        {
-               w.Write (Count);
-               foreach (string key in Keys) {
-                       w.Write (key);
-                       object value = BaseGet (key);
-                       if (value == null) {
-                               w.Write (16); // types.Count + 1
-                               continue;
-                       }
+               lock (this) {
+                       w.Write (Count);
+                       foreach (string key in Keys) {
+                               w.Write (key);
+                               object value = BaseGet (key);
+                               if (value == null) {
+                                       w.Write (16); // types.Count + 1
+                                       continue;
+                               }
 
-                       SerializeByType (w, value);
+                               SerializeByType (w, value);
+                       }
                }
        }
 
@@ -225,18 +234,35 @@ internal class SessionDictionary : NameObjectCollectionBase
 
        internal object this [string s]
        {
-               get { return BaseGet (s); }
+               get {
+                       object o;
+                       lock (this)
+                               o = BaseGet (s);
+
+                       return o;
+               }
+
                set {
-                       BaseSet (s, value);
+                       lock (this)
+                               BaseSet (s, value);
+
                        _dirty = true;
                }
        }
 
        public object this [int index]
        {
-               get { return BaseGet (index); }
+               get {
+                       object o;
+                       lock (this)
+                               o = BaseGet (index);
+
+                       return o;
+               }
                set {
-                       BaseSet (index, value);
+                       lock (this)
+                               BaseSet (index, value);
+
                        _dirty = true;
                }
        }
index 1cf8a3a152dd0250453e825f2bfbfd3d9d92fd85..6e7d3ab8ad3a451bb0b676400793a3a696aef994 100644 (file)
@@ -89,7 +89,7 @@ namespace System.Web.SessionState
                                        // update the timestamp.
                                        container.Touch ();
                                         // Can we do this? It feels safe, but what do I know.
-                                       context.Session = container.SessionState;
+                                       context.SetSession (container.SessionState);
                                        return false; // and we're done
                                } else if(container!=null) {
                                        //A empty or expired session, lets kill it.
@@ -111,7 +111,7 @@ namespace System.Web.SessionState
                        _sessionTable [sessionID]=container;
 
                        // and returns it.
-                       context.Session = container.SessionState;
+                       context.SetSession (container.SessionState);
                        context.Session.IsNewSession = true;
 
 
index 4abaee0bb4548b92f56238cc4e13c953504fb48c..7544a579a1f76d5d6c4a596edd8aeec8a257af63 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-08  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpContext.cs: Session doesn't have a setter.
+
+       * HttpResponse.cs: Request is private.
+
 2003-07-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * HttpRequest.cs: fixed Headers property. It was getting known headers
index 717f8ccc839ad0ffd8192c3da29ac18034087709..93283fcdd486e7f82b2579181ccff3e2782880fd 100644 (file)
@@ -204,11 +204,6 @@ namespace System.Web
                        get {
                                return (HttpSessionState) _oSession;
                        }
-
-                       set {
-                               //FIXME: gotta remove set
-                               _oSession=value;
-                       }
                }
 
                public bool SkipAuthorization
@@ -247,6 +242,11 @@ namespace System.Web
                        }
                }
 
+               internal void SetSession (HttpSessionState session)
+               {
+                       _oSession = session;
+               }
+               
                public void AddError (Exception errorInfo)
                {
                        if (_arrExceptions == null)
index 07087d70a9dce83dfd8246bf9a56767f90b6bbd3..63a3d8553da5e19c311c74c366acb879db1979ee 100644 (file)
@@ -519,7 +519,7 @@ namespace System.Web
                        }
                }
 
-               public HttpRequest Request
+               HttpRequest Request
                {
                        get {
                                if (_Context == null)