diff options
author | lbsa71 | 2007-07-13 07:19:00 +0000 |
---|---|---|
committer | lbsa71 | 2007-07-13 07:19:00 +0000 |
commit | a0ac1f06e62bdfcf08264c8e89fb4e42a2d1f5d6 (patch) | |
tree | 6506411c17915cbc94fee8d115c0d4975dca0531 /OpenSim/Framework/Servers | |
parent | * Fixing compiler warnings in an attempt to reduce them back down to zero. (diff) | |
download | opensim-SC-a0ac1f06e62bdfcf08264c8e89fb4e42a2d1f5d6.zip opensim-SC-a0ac1f06e62bdfcf08264c8e89fb4e42a2d1f5d6.tar.gz opensim-SC-a0ac1f06e62bdfcf08264c8e89fb4e42a2d1f5d6.tar.bz2 opensim-SC-a0ac1f06e62bdfcf08264c8e89fb4e42a2d1f5d6.tar.xz |
* Moved SendNameReply to ClientView
* Removed unused LoginService
* Minor renames on BinaryStreamHandler
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/BinaryStreamHandler.cs | 19 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/RestMethod.cs | 1 |
2 files changed, 12 insertions, 8 deletions
diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs index 302dbff..7d4e4ce 100644 --- a/OpenSim/Framework/Servers/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs | |||
@@ -5,27 +5,28 @@ using System.IO; | |||
5 | 5 | ||
6 | namespace OpenSim.Framework.Servers | 6 | namespace OpenSim.Framework.Servers |
7 | { | 7 | { |
8 | public delegate string BinaryMethod(byte[] data, string path, string param); | ||
8 | 9 | ||
9 | public class BinaryStreamHandler : BaseStreamHandler | 10 | public class BinaryStreamHandler : BaseStreamHandler |
10 | { | 11 | { |
11 | BinaryMethod m_restMethod; | 12 | BinaryMethod m_method; |
12 | 13 | ||
13 | override public byte[] Handle(string path, Stream request) | 14 | override public byte[] Handle(string path, Stream request) |
14 | { | 15 | { |
15 | byte[] data = ReadFully(request); | 16 | byte[] data = ReadFully(request); |
16 | string param = GetParam(path); | 17 | string param = GetParam(path); |
17 | string responseString = m_restMethod(data, path, param); | 18 | string responseString = m_method(data, path, param); |
18 | 19 | ||
19 | return Encoding.UTF8.GetBytes(responseString); | 20 | return Encoding.UTF8.GetBytes(responseString); |
20 | } | 21 | } |
21 | 22 | ||
22 | public BinaryStreamHandler(string httpMethod, string path, BinaryMethod restMethod) | 23 | public BinaryStreamHandler(string httpMethod, string path, BinaryMethod binaryMethod) |
23 | : base(httpMethod, path) | 24 | : base(httpMethod, path) |
24 | { | 25 | { |
25 | m_restMethod = restMethod; | 26 | m_method = binaryMethod; |
26 | } | 27 | } |
27 | 28 | ||
28 | public byte[] ReadFully(Stream stream) | 29 | private byte[] ReadFully(Stream stream) |
29 | { | 30 | { |
30 | byte[] buffer = new byte[32768]; | 31 | byte[] buffer = new byte[32768]; |
31 | using (MemoryStream ms = new MemoryStream()) | 32 | using (MemoryStream ms = new MemoryStream()) |
@@ -33,11 +34,15 @@ namespace OpenSim.Framework.Servers | |||
33 | while (true) | 34 | while (true) |
34 | { | 35 | { |
35 | int read = stream.Read(buffer, 0, buffer.Length); | 36 | int read = stream.Read(buffer, 0, buffer.Length); |
37 | |||
36 | if (read <= 0) | 38 | if (read <= 0) |
39 | { | ||
37 | return ms.ToArray(); | 40 | return ms.ToArray(); |
41 | } | ||
42 | |||
38 | ms.Write(buffer, 0, read); | 43 | ms.Write(buffer, 0, read); |
39 | } | 44 | } |
40 | } | 45 | } |
41 | } | 46 | } |
42 | } | 47 | } |
43 | 48 | ||
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs index 2a92fc1..c6cb230 100644 --- a/OpenSim/Framework/Servers/RestMethod.cs +++ b/OpenSim/Framework/Servers/RestMethod.cs | |||
@@ -28,5 +28,4 @@ | |||
28 | namespace OpenSim.Framework.Servers | 28 | namespace 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); | ||
32 | } | 31 | } |