From 25111e703f54d84c7c51e32db1f94332ea3ffd00 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 11 Sep 2012 21:48:02 +0100
Subject: Add levels 4 and 5 to "debug http" console command that will log a
sample of incoming request data and the entire incoming data respectively.
See "help debug http" for more details.
---
OpenSim/Framework/Util.cs | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 38cb3a6..1b9777f 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1007,6 +1007,38 @@ namespace OpenSim.Framework
}
}
+ ///
+ /// Copy data from one stream to another, leaving the read position of both streams at the beginning.
+ ///
+ ///
+ /// Input stream. Must be seekable.
+ ///
+ ///
+ /// Thrown if the input stream is not seekable.
+ ///
+ public static Stream Copy(Stream inputStream)
+ {
+ if (!inputStream.CanSeek)
+ throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek");
+
+ const int readSize = 256;
+ byte[] buffer = new byte[readSize];
+ MemoryStream ms = new MemoryStream();
+
+ int count = inputStream.Read(buffer, 0, readSize);
+
+ while (count > 0)
+ {
+ ms.Write(buffer, 0, count);
+ count = inputStream.Read(buffer, 0, readSize);
+ }
+
+ ms.Position = 0;
+ inputStream.Position = 0;
+
+ return ms;
+ }
+
public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
{
return SendXmlRpcCommand(url, methodName, args);
--
cgit v1.1