Prechádzať zdrojové kódy

* HttpResponse.cs: When caching data set the content length in the
cached repsonse so that only that amount will be written back to
the client. Add method to write a range of binary data.
* HttpCacheVaryByParams.cs: Add method to retrieve param
names.

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

Jackson Harper 22 rokov pred
rodič
commit
bcf89fd02c

+ 7 - 0
mcs/class/System.Web/System.Web/ChangeLog

@@ -1,3 +1,10 @@
+2003-11-21  Jackson Harper <[email protected]>
+
+	* HttpResponse.cs: When caching data set the content length in the
+	cached repsonse so that only that amount will be written back to
+	the client. Add method to write a range of binary data.
+	* HttpCacheVaryByParams.cs: Add method to retrieve param names.
+	
 2003-11-21  Gonzalo Paniagua Javier <[email protected]>
 
 	* HttpApplication.cs:

+ 13 - 0
mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs

@@ -96,5 +96,18 @@ namespace System.Web {
             }
          }
       }
+
+	   internal string [] GetParamNames ()
+	   {
+		   if (_Items == null)
+			   return null;
+
+		   string[] prms = new string [_Items.Count];
+		   int i = 0;
+		   foreach (string prm in _Items.Keys)
+			   prms [i++] = prm;
+		   
+		   return prms;
+	   }
    }
 }

+ 9 - 2
mcs/class/System.Web/System.Web/HttpResponse.cs

@@ -133,7 +133,7 @@ namespace System.Web
 		}
 		
 		internal void CacheResponse (HttpRequest request) {
-			cached_response = new CachedRawResponse (_CachePolicy, request);
+			cached_response = new CachedRawResponse (_CachePolicy);
 		}
 
 		internal CachedRawResponse GetCachedResponse () {
@@ -630,6 +630,11 @@ namespace System.Web
 			OutputStream.Write (buffer, 0, buffer.Length);
 		}
 
+		internal void BinaryWrite (byte [] buffer, int start, int length)
+		{
+			OutputStream.Write (buffer, start, length);
+		}
+		
 		public void Clear ()
 		{
 			if (_Writer != null)
@@ -793,8 +798,10 @@ namespace System.Web
 				}
 
 				_WorkerRequest.FlushResponse (bFinish);
-				if (IsCached)
+				if (IsCached) {
+					cached_response.ContentLength = (int) length;
 					cached_response.SetData (_Writer.GetBuffer ());
+				}
 				_Writer.Clear ();
 			} finally {
 				if (bFinish)