aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/BinaryStreamHandler.cs
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/BinaryStreamHandler.cs
parentupdated libsecondlife.dll to a 1.18 version (from the libsecondlife aditi bra... (diff)
downloadopensim-SC_OLD-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.zip
opensim-SC_OLD-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.gz
opensim-SC_OLD-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.bz2
opensim-SC_OLD-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/BinaryStreamHandler.cs')
-rw-r--r--OpenSim/Framework/Servers/BinaryStreamHandler.cs44
1 files changed, 44 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}