aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorMW2007-07-11 17:47:25 +0000
committerMW2007-07-11 17:47:25 +0000
commit2ceff87a02d9862497d1d8fa965851ae2d9c9b1b (patch)
tree47cbd7a3fe7678c9ac2d56ace21ea4ebf8f628ef /OpenSim/Framework/Servers
parentupdated libsecondlife.dll to a 1.18 version (from the libsecondlife aditi bra... (diff)
downloadopensim-SC-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.zip
opensim-SC-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.gz
opensim-SC-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.bz2
opensim-SC-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.xz
More work on UserProfile and inventory cache (still currently not enabled).
Asset uploading over CAPS now works, and although inventory isn't really working yet, this should now at least enables texturing of prims.
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/BinaryStreamHandler.cs44
-rw-r--r--OpenSim/Framework/Servers/RestMethod.cs1
2 files changed, 45 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs
new file mode 100644
index 0000000..302dbff
--- /dev/null
+++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs
@@ -0,0 +1,44 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5
6namespace OpenSim.Framework.Servers
7{
8
9 public class BinaryStreamHandler : BaseStreamHandler
10 {
11 BinaryMethod m_restMethod;
12
13 override public byte[] Handle(string path, Stream request)
14 {
15 byte[] data = ReadFully(request);
16 string param = GetParam(path);
17 string responseString = m_restMethod(data, path, param);
18
19 return Encoding.UTF8.GetBytes(responseString);
20 }
21
22 public BinaryStreamHandler(string httpMethod, string path, BinaryMethod restMethod)
23 : base(httpMethod, path)
24 {
25 m_restMethod = restMethod;
26 }
27
28 public byte[] ReadFully(Stream stream)
29 {
30 byte[] buffer = new byte[32768];
31 using (MemoryStream ms = new MemoryStream())
32 {
33 while (true)
34 {
35 int read = stream.Read(buffer, 0, buffer.Length);
36 if (read <= 0)
37 return ms.ToArray();
38 ms.Write(buffer, 0, read);
39 }
40 }
41 }
42 }
43
44}
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs
index c6cb230..2a92fc1 100644
--- a/OpenSim/Framework/Servers/RestMethod.cs
+++ b/OpenSim/Framework/Servers/RestMethod.cs
@@ -28,4 +28,5 @@
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{ 29{
30 public delegate string RestMethod( string request, string path, string param ); 30 public delegate string RestMethod( string request, string path, string param );
31 public delegate string BinaryMethod(byte[] data, string path, string param);
31} 32}