Forráskód Böngészése

2005-04-07 Gonzalo Paniagua Javier <[email protected]>

	* WebHeaderCollection.cs: added if-modified-since to the list of
	restricted headers.

	* ServicePoint.cs: use a field object when locking.


svn path=/trunk/mcs/; revision=42651
Gonzalo Paniagua Javier 21 éve
szülő
commit
7ce7ccda6c

+ 6 - 5
mcs/class/System/System.Net/ServicePoint.cs

@@ -53,6 +53,7 @@ namespace System.Net
 		Hashtable groups;
 		bool sendContinue = true;
 		bool useConnect;
+		object locker = new object ();
 #if NET_1_1
 		bool useNagle;
 #endif
@@ -98,7 +99,7 @@ namespace System.Net
 
 		public int CurrentConnections {
 			get {
-				lock (this) {
+				lock (locker) {
 					return currentConnections;
 				}
 			}
@@ -106,7 +107,7 @@ namespace System.Net
 
 		public DateTime IdleSince {
 			get {
-				lock (this) {
+				lock (locker) {
 					return idleSince;
 				}
 			}
@@ -241,7 +242,7 @@ namespace System.Net
 		{
 			WebConnection cnc;
 			
-			lock (this) {
+			lock (locker) {
 				WebConnectionGroup cncGroup = GetConnectionGroup (groupName);
 				cnc = cncGroup.GetConnection ();
 			}
@@ -251,7 +252,7 @@ namespace System.Net
 
 		internal void IncrementConnection ()
 		{
-			lock (this) {
+			lock (locker) {
 				currentConnections++;
 				idleSince = DateTime.Now.AddMilliseconds (1000000);
 			}
@@ -259,7 +260,7 @@ namespace System.Net
 
 		internal void DecrementConnection ()
 		{
-			lock (this) {
+			lock (locker) {
 				currentConnections--;
 				if (currentConnections == 0)
 					idleSince = DateTime.Now;

+ 2 - 1
mcs/class/System/System.Net/WebHeaderCollection.cs

@@ -64,6 +64,7 @@ namespace System.Net
 			restricted.Add ("date", true);
 			restricted.Add ("expect", true);
 			restricted.Add ("host", true);
+			restricted.Add ("if-modified-since", true);
 			restricted.Add ("range", true);
 			restricted.Add ("referer", true);
 			restricted.Add ("transfer-encoding", true);
@@ -139,7 +140,7 @@ namespace System.Net
 			if (name == null)
 				throw new ArgumentNullException ("name");
 			if (internallyCreated && IsRestricted (name))
-				throw new ArgumentException ("restricted header");
+				throw new ArgumentException ("This header must be modified with the appropiate property.");
 			this.AddWithoutValidate (name, value);
 		}