From 646bbbc84b8010e0dacbeed5342cdb045f46cc49 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 27 Jun 2007 15:28:52 +0000 Subject: Some work on restructuring the namespaces / project names. Note this doesn't compile yet as not all the code has been changed to use the new namespaces. Am committing it now for feedback on the namespaces. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 312 +++++++++++++++++++++ OpenSim/Framework/Servers/CheckSumServer.cs | 141 ++++++++++ OpenSim/Framework/Servers/IRestHandler.cs | 35 +++ .../Servers/OpenSim.Framework.Servers.csproj | 116 ++++++++ .../Servers/OpenSim.Framework.Servers.csproj.user | 12 + OpenSim/Framework/Servers/UDPServerBase.cs | 95 +++++++ OpenSim/Framework/Servers/XmlRpcMethod.cs | 34 +++ 7 files changed, 745 insertions(+) create mode 100644 OpenSim/Framework/Servers/BaseHttpServer.cs create mode 100644 OpenSim/Framework/Servers/CheckSumServer.cs create mode 100644 OpenSim/Framework/Servers/IRestHandler.cs create mode 100644 OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj create mode 100644 OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj.user create mode 100644 OpenSim/Framework/Servers/UDPServerBase.cs create mode 100644 OpenSim/Framework/Servers/XmlRpcMethod.cs (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs new file mode 100644 index 0000000..e55e33c --- /dev/null +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -0,0 +1,312 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +//using OpenSim.CAPS; +using Nwc.XmlRpc; +using System.Collections; +using OpenSim.Framework.Console; + +namespace OpenSim.Servers +{ + public class BaseHttpServer + { + protected class RestMethodEntry + { + private string m_path; + public string Path + { + get { return m_path; } + } + + private RestMethod m_restMethod; + public RestMethod RestMethod + { + get { return m_restMethod; } + } + + public RestMethodEntry(string path, RestMethod restMethod) + { + m_path = path; + m_restMethod = restMethod; + } + } + + protected Thread m_workerThread; + protected HttpListener m_httpListener; + protected Dictionary m_restHandlers = new Dictionary(); + protected Dictionary m_rpcHandlers = new Dictionary(); + protected int m_port; + protected bool firstcaps = true; + + public BaseHttpServer(int port) + { + m_port = port; + } + + public bool AddRestHandler(string method, string path, RestMethod handler) + { + //Console.WriteLine("adding new REST handler for path " + path); + string methodKey = String.Format("{0}: {1}", method, path); + + if (!this.m_restHandlers.ContainsKey(methodKey)) + { + this.m_restHandlers.Add(methodKey, new RestMethodEntry(path, handler)); + return true; + } + + //must already have a handler for that path so return false + return false; + } + + public bool RemoveRestHandler(string method, string path) + { + string methodKey = String.Format("{0}: {1}", method, path); + if (this.m_restHandlers.ContainsKey(methodKey)) + { + this.m_restHandlers.Remove(methodKey); + return true; + } + return false; + } + + public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) + { + if (!this.m_rpcHandlers.ContainsKey(method)) + { + this.m_rpcHandlers.Add(method, handler); + return true; + } + + //must already have a handler for that path so return false + return false; + } + + protected virtual string ProcessXMLRPCMethod(string methodName, XmlRpcRequest request) + { + XmlRpcResponse response; + + XmlRpcMethod method; + if (this.m_rpcHandlers.TryGetValue(methodName, out method)) + { + response = method(request); + } + else + { + response = new XmlRpcResponse(); + Hashtable unknownMethodError = new Hashtable(); + unknownMethodError["reason"] = "XmlRequest"; ; + unknownMethodError["message"] = "Unknown Rpc request"; + unknownMethodError["login"] = "false"; + response.Value = unknownMethodError; + } + + return XmlRpcResponseSerializer.Singleton.Serialize(response); + } + + protected virtual string ParseREST(string request, string path, string method) + { + string response; + + string requestKey = String.Format("{0}: {1}", method, path); + + string bestMatch = String.Empty; + foreach (string currentKey in m_restHandlers.Keys) + { + if (requestKey.StartsWith(currentKey)) + { + if (currentKey.Length > bestMatch.Length) + { + bestMatch = currentKey; + } + } + } + + RestMethodEntry restMethodEntry; + if (m_restHandlers.TryGetValue(bestMatch, out restMethodEntry)) + { + RestMethod restMethod = restMethodEntry.RestMethod; + + string param = path.Substring(restMethodEntry.Path.Length); + response = restMethod(request, path, param); + + } + else + { + response = String.Empty; + } + + return response; + } + + protected virtual string ParseLLSDXML(string requestBody) + { + // dummy function for now - IMPLEMENT ME! + Console.WriteLine("LLSD request "+requestBody); + string resp = ""; + if (firstcaps) + { + resp = "MapLayerhttp://127.0.0.1:9000/CAPS/"; + firstcaps = false; + } + return resp; + } + + protected virtual string ParseXMLRPC(string requestBody) + { + string responseString = String.Empty; + + try + { + XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); + + string methodName = request.MethodName; + + responseString = ProcessXMLRPCMethod(methodName, request); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + return responseString; + } + + public virtual void HandleRequest(Object stateinfo) + { + try + { + HttpListenerContext context = (HttpListenerContext)stateinfo; + + HttpListenerRequest request = context.Request; + HttpListenerResponse response = context.Response; + + response.KeepAlive = false; + response.SendChunked = false; + + System.IO.Stream body = request.InputStream; + System.Text.Encoding encoding = System.Text.Encoding.UTF8; + System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); + + string requestBody = reader.ReadToEnd(); + body.Close(); + reader.Close(); + + //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType); + //Console.WriteLine(requestBody); + + string responseString = ""; + // Console.WriteLine("new request " + request.ContentType +" at "+ request.RawUrl); + switch (request.ContentType) + { + case "text/xml": + // must be XML-RPC, so pass to the XML-RPC parser + + responseString = ParseXMLRPC(requestBody); + responseString = Regex.Replace(responseString, "utf-16", "utf-8"); + + response.AddHeader("Content-type", "text/xml"); + break; + + case "application/xml": + // probably LLSD we hope, otherwise it should be ignored by the parser + // responseString = ParseLLSDXML(requestBody); + responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + response.AddHeader("Content-type", "application/xml"); + break; + + case "application/octet-stream": + // probably LLSD we hope, otherwise it should be ignored by the parser + // responseString = ParseLLSDXML(requestBody); + responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + response.AddHeader("Content-type", "application/xml"); + break; + + case "application/x-www-form-urlencoded": + // a form data POST so send to the REST parser + responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + response.AddHeader("Content-type", "text/html"); + break; + + case null: + // must be REST or invalid crap, so pass to the REST parser + responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + response.AddHeader("Content-type", "text/html"); + break; + + } + + byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); + System.IO.Stream output = response.OutputStream; + response.SendChunked = false; + response.ContentLength64 = buffer.Length; + output.Write(buffer, 0, buffer.Length); + output.Close(); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + } + + public void Start() + { + OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: Starting up HTTP Server"); + + m_workerThread = new Thread(new ThreadStart(StartHTTP)); + m_workerThread.IsBackground = true; + m_workerThread.Start(); + } + + private void StartHTTP() + { + try + { + OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: StartHTTP() - Spawned main thread OK"); + m_httpListener = new HttpListener(); + + m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); + m_httpListener.Start(); + + HttpListenerContext context; + while (true) + { + context = m_httpListener.GetContext(); + ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.MEDIUM, e.Message); + } + } + } +} diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs new file mode 100644 index 0000000..a359205 --- /dev/null +++ b/OpenSim/Framework/Servers/CheckSumServer.cs @@ -0,0 +1,141 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Text; +using System.IO; +using System.Threading; +using System.Net; +using System.Net.Sockets; +using System.Timers; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; +using OpenSim.Framework.Console; + + +namespace OpenSim.Servers +{ +/* public class CheckSumServer : UDPServerBase + { + //protected ConsoleBase m_log; + + public CheckSumServer(int port) + : base(port) + { + } + + protected override void OnReceivedData(IAsyncResult result) + { + ipeSender = new IPEndPoint(IPAddress.Any, 0); + epSender = (EndPoint)ipeSender; + Packet packet = null; + int numBytes = Server.EndReceiveFrom(result, ref epSender); + int packetEnd = numBytes - 1; + + packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); + + if (packet.Type == PacketType.SecuredTemplateChecksumRequest) + { + SecuredTemplateChecksumRequestPacket checksum = (SecuredTemplateChecksumRequestPacket)packet; + TemplateChecksumReplyPacket checkreply = new TemplateChecksumReplyPacket(); + checkreply.DataBlock.Checksum = 3220703154;//180572585; + checkreply.DataBlock.Flags = 0; + checkreply.DataBlock.MajorVersion = 1; + checkreply.DataBlock.MinorVersion = 15; + checkreply.DataBlock.PatchVersion = 0; + checkreply.DataBlock.ServerVersion = 0; + checkreply.TokenBlock.Token = checksum.TokenBlock.Token; + this.SendPacket(checkreply, epSender); + + /* + //if we wanted to echo the the checksum/ version from the client (so that any client worked) + SecuredTemplateChecksumRequestPacket checkrequest = new SecuredTemplateChecksumRequestPacket(); + checkrequest.TokenBlock.Token = checksum.TokenBlock.Token; + this.SendPacket(checkrequest, epSender); + + } + else if (packet.Type == PacketType.TemplateChecksumReply) + { + //echo back the client checksum reply (Hegemon's method) + TemplateChecksumReplyPacket checksum2 = (TemplateChecksumReplyPacket)packet; + TemplateChecksumReplyPacket checkreply2 = new TemplateChecksumReplyPacket(); + checkreply2.DataBlock.Checksum = checksum2.DataBlock.Checksum; + checkreply2.DataBlock.Flags = checksum2.DataBlock.Flags; + checkreply2.DataBlock.MajorVersion = checksum2.DataBlock.MajorVersion; + checkreply2.DataBlock.MinorVersion = checksum2.DataBlock.MinorVersion; + checkreply2.DataBlock.PatchVersion = checksum2.DataBlock.PatchVersion; + checkreply2.DataBlock.ServerVersion = checksum2.DataBlock.ServerVersion; + checkreply2.TokenBlock.Token = checksum2.TokenBlock.Token; + this.SendPacket(checkreply2, epSender); + } + else + { + } + + Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); + } + + private void SendPacket(Packet Pack, EndPoint endp) + { + if (!Pack.Header.Resent) + { + Pack.Header.Sequence = 1; + } + + byte[] ZeroOutBuffer = new byte[4096]; + byte[] sendbuffer; + sendbuffer = Pack.ToBytes(); + + try + { + if (Pack.Header.Zerocoded) + { + int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); + this.SendPackTo(ZeroOutBuffer, packetsize, SocketFlags.None, endp); + } + else + { + this.SendPackTo(sendbuffer, sendbuffer.Length, SocketFlags.None, endp); + } + } + catch (Exception) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection "); + + } + } + + private void SendPackTo(byte[] buffer, int size, SocketFlags flags, EndPoint endp) + { + this.Server.SendTo(buffer, size, flags, endp); + } + * + }*/ +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/IRestHandler.cs b/OpenSim/Framework/Servers/IRestHandler.cs new file mode 100644 index 0000000..3aa508c --- /dev/null +++ b/OpenSim/Framework/Servers/IRestHandler.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Servers +{ + public delegate string RestMethod( string request, string path, string param ); +} diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj new file mode 100644 index 0000000..399f456 --- /dev/null +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -0,0 +1,116 @@ + + + Local + 8.0.50727 + 2.0 + {2CC71860-0000-0000-0000-000000000000} + Debug + AnyCPU + + + + OpenSim.Framework.Servers + JScript + Grid + IE50 + false + Library + + OpenSim.Framework.Servers + + + + + + False + 285212672 + False + + + TRACE;DEBUG + + True + 4096 + False + ..\..\..\bin\ + False + False + False + 4 + + + + False + 285212672 + False + + + TRACE + + False + 4096 + True + ..\..\..\bin\ + False + False + False + 4 + + + + + ..\..\..\bin\libsecondlife.dll + False + + + System.dll + False + + + System.Xml.dll + False + + + ..\..\..\bin\XMLRPC.dll + False + + + + + OpenSim.Framework + {8ACA2445-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + OpenSim.Framework.Console + {A7CD0630-0000-0000-0000-000000000000} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + False + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj.user b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj.user new file mode 100644 index 0000000..6841907 --- /dev/null +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj.user @@ -0,0 +1,12 @@ + + + Debug + AnyCPU + C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ + 8.0.50727 + ProjectFiles + 0 + + + + diff --git a/OpenSim/Framework/Servers/UDPServerBase.cs b/OpenSim/Framework/Servers/UDPServerBase.cs new file mode 100644 index 0000000..b472c97 --- /dev/null +++ b/OpenSim/Framework/Servers/UDPServerBase.cs @@ -0,0 +1,95 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Text; +using System.IO; +using System.Threading; +using System.Net; +using System.Net.Sockets; +using System.Timers; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; +using libsecondlife.Packets; + +namespace OpenSim.Servers +{ + public class UDPServerBase + { + public Socket Server; + protected IPEndPoint ServerIncoming; + protected byte[] RecvBuffer = new byte[4096]; + protected byte[] ZeroBuffer = new byte[8192]; + protected IPEndPoint ipeSender; + protected EndPoint epSender; + protected AsyncCallback ReceivedData; + protected int listenPort; + + public UDPServerBase(int port) + { + listenPort = port; + } + + protected virtual void OnReceivedData(IAsyncResult result) + { + ipeSender = new IPEndPoint(IPAddress.Any, 0); + epSender = (EndPoint)ipeSender; + Packet packet = null; + int numBytes = Server.EndReceiveFrom(result, ref epSender); + int packetEnd = numBytes - 1; + + packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); + + Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); + } + + protected virtual void AddNewClient(Packet packet) + { + } + + public virtual void ServerListener() + { + + ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); + Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + Server.Bind(ServerIncoming); + + ipeSender = new IPEndPoint(IPAddress.Any, 0); + epSender = (EndPoint)ipeSender; + ReceivedData = new AsyncCallback(this.OnReceivedData); + Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); + } + + public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) + { + + } + } +} + diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs new file mode 100644 index 0000000..05cbf2e --- /dev/null +++ b/OpenSim/Framework/Servers/XmlRpcMethod.cs @@ -0,0 +1,34 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using Nwc.XmlRpc; + +namespace OpenSim.Servers +{ + public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request ); +} -- cgit v1.1 From e41eedc9aeba3eb36cdba4fcdf1e57bea976cab4 Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 16:39:11 +0000 Subject: *Some more restructuring/fixing -- should compile, but high chance I forgot to add/remove something --- OpenSim/Framework/Servers/BaseHttpServer.cs | 8 ++++---- OpenSim/Framework/Servers/CheckSumServer.cs | 2 +- OpenSim/Framework/Servers/IRestHandler.cs | 2 +- OpenSim/Framework/Servers/UDPServerBase.cs | 2 +- OpenSim/Framework/Servers/XmlRpcMethod.cs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index e55e33c..bc638dd 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -36,7 +36,7 @@ using Nwc.XmlRpc; using System.Collections; using OpenSim.Framework.Console; -namespace OpenSim.Servers +namespace OpenSim.Framework.Servers { public class BaseHttpServer { @@ -171,7 +171,7 @@ namespace OpenSim.Servers protected virtual string ParseLLSDXML(string requestBody) { // dummy function for now - IMPLEMENT ME! - Console.WriteLine("LLSD request "+requestBody); + //Console.WriteLine("LLSD request "+requestBody); string resp = ""; if (firstcaps) { @@ -195,7 +195,7 @@ namespace OpenSim.Servers } catch (Exception e) { - Console.WriteLine(e.ToString()); + //Console.WriteLine(e.ToString()); } return responseString; } @@ -273,7 +273,7 @@ namespace OpenSim.Servers } catch (Exception e) { - Console.WriteLine(e.ToString()); + //Console.WriteLine(e.ToString()); } } diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs index a359205..6aeb58c 100644 --- a/OpenSim/Framework/Servers/CheckSumServer.cs +++ b/OpenSim/Framework/Servers/CheckSumServer.cs @@ -40,7 +40,7 @@ using libsecondlife.Packets; using OpenSim.Framework.Console; -namespace OpenSim.Servers +namespace OpenSim.Framework.Servers { /* public class CheckSumServer : UDPServerBase { diff --git a/OpenSim/Framework/Servers/IRestHandler.cs b/OpenSim/Framework/Servers/IRestHandler.cs index 3aa508c..a2b6bf0 100644 --- a/OpenSim/Framework/Servers/IRestHandler.cs +++ b/OpenSim/Framework/Servers/IRestHandler.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Servers +namespace OpenSim.Framework.Servers { public delegate string RestMethod( string request, string path, string param ); } diff --git a/OpenSim/Framework/Servers/UDPServerBase.cs b/OpenSim/Framework/Servers/UDPServerBase.cs index b472c97..610d23b 100644 --- a/OpenSim/Framework/Servers/UDPServerBase.cs +++ b/OpenSim/Framework/Servers/UDPServerBase.cs @@ -38,7 +38,7 @@ using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; -namespace OpenSim.Servers +namespace OpenSim.Framework.Servers { public class UDPServerBase { diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs index 05cbf2e..51b3303 100644 --- a/OpenSim/Framework/Servers/XmlRpcMethod.cs +++ b/OpenSim/Framework/Servers/XmlRpcMethod.cs @@ -28,7 +28,7 @@ using System; using Nwc.XmlRpc; -namespace OpenSim.Servers +namespace OpenSim.Framework.Servers { public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request ); } -- cgit v1.1 From fe120533efd0ec6b2248d96b9a1f8b7637c5dadd Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 17:12:32 +0000 Subject: *Updated prebuild.xml and ran prebuild again *Removed .user, .suo, and unneccessary files in /bin/Physics/ *OpenSim.sln should compile with nant and on windows now --- OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj | 8 ++++---- .../Framework/Servers/OpenSim.Framework.Servers.csproj.user | 12 ------------ 2 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj.user (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 399f456..5262224 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -93,16 +93,16 @@ Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj.user b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj.user deleted file mode 100644 index 6841907..0000000 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\NameSpaceChanges\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - -- cgit v1.1 From 14ea54b44158a68aed767bbf5cc3497b4f64850c Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 11:54:51 +0000 Subject: should now work. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index bc638dd..8c8204a 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -31,7 +31,6 @@ using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Threading; -//using OpenSim.CAPS; using Nwc.XmlRpc; using System.Collections; using OpenSim.Framework.Console; -- cgit v1.1 From 3456d951d89fbc83f742d40ca8ca2a1a79d414eb Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 13:13:17 +0000 Subject: Imported the scripting changes, so now should be up to date with sugilite. --- .../Servers/OpenSim.Framework.Servers.csproj | 8 ++-- .../Servers/OpenSim.Framework.Servers.dll.build | 48 ++++++++++++++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 5262224..399f456 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -93,16 +93,16 @@ Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build new file mode 100644 index 0000000..7401b07 --- /dev/null +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.1 From 108d89f89436556c8f4662197903c374db943f7d Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 28 Jun 2007 16:17:20 +0000 Subject: *Master User is now set up *Added support for getting user profile information from remote grid server (untested) *Updated prebuild.xml --- OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj | 8 ++++---- OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 399f456..2301fa6 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -90,19 +90,19 @@ - + Code - + Code - + Code Code - + Code diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index 7401b07..bb20780 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -11,11 +11,11 @@ - - - + + + -- cgit v1.1 From 135e9b1f538ae77dfd8bf68139c960fb8e016c16 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 28 Jun 2007 19:35:20 +0000 Subject: * Removed J# language support because it has issues with Mono. --- OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj | 8 ++++---- OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 2301fa6..399f456 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -90,19 +90,19 @@ - + Code - + Code - + Code Code - + Code diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index bb20780..7401b07 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -11,11 +11,11 @@ - - + + - + -- cgit v1.1 From 6b3777d3db323f2054aeff1ba4be3e78edef21b8 Mon Sep 17 00:00:00 2001 From: mingchen Date: Fri, 29 Jun 2007 16:43:48 +0000 Subject: *Deleted Logger.cs from OpenSim.Framework --- OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj | 8 ++++---- OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 399f456..5262224 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -93,16 +93,16 @@ Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index 7401b07..96b937c 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -12,10 +12,10 @@ - - + + -- cgit v1.1 From 72cd28be1b743a61c739d7d13f933cf41e948fdf Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Fri, 29 Jun 2007 20:09:29 +0000 Subject: * Experimental patch: Replaced IPAddress.Any with IPAddress.Parse("0.0.0.0") to force IPv4 --- OpenSim/Framework/Servers/UDPServerBase.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/UDPServerBase.cs b/OpenSim/Framework/Servers/UDPServerBase.cs index 610d23b..2617c56 100644 --- a/OpenSim/Framework/Servers/UDPServerBase.cs +++ b/OpenSim/Framework/Servers/UDPServerBase.cs @@ -58,7 +58,7 @@ namespace OpenSim.Framework.Servers protected virtual void OnReceivedData(IAsyncResult result) { - ipeSender = new IPEndPoint(IPAddress.Any, 0); + ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); epSender = (EndPoint)ipeSender; Packet packet = null; int numBytes = Server.EndReceiveFrom(result, ref epSender); @@ -76,11 +76,11 @@ namespace OpenSim.Framework.Servers public virtual void ServerListener() { - ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); + ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort); Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); Server.Bind(ServerIncoming); - ipeSender = new IPEndPoint(IPAddress.Any, 0); + ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); epSender = (EndPoint)ipeSender; ReceivedData = new AsyncCallback(this.OnReceivedData); Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); -- cgit v1.1 From 5e805656db1215518a344d6d5364629a4997fd47 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 13:17:27 +0000 Subject: Fixed SimpleApp - aka thankgoditssundaycommit * Updated SimpleApp with various introduced dependencies * Extracted ScenePrescence creation in Scene * removed try-catchall from UserManagerBase (that actually hid a bug) * Refactored RegionInfo * handle is calculated * it will explode upon accessing x,y,ip,port,externalip if not explicitly initialized * Removed superfluous 'ref' keywords * Removed a shitload of 'catch Exception e' that causes build warnings * Lots of small refactorings, renames et c * Ignored some bins --- OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj | 8 ++++---- OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 5262224..399f456 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -93,16 +93,16 @@ Code - + Code - + Code - + Code - + Code diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index 96b937c..7401b07 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -12,10 +12,10 @@ - - + + -- cgit v1.1 From 9800c05c1b3c7804466d6f3a9c38a739156625fd Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Jul 2007 17:26:33 +0000 Subject: Started change to having SceneObject and then that having child Primitives which in turn have a Shape object (currently PrimitiveBaseShape). The plan is only for the SceneObject to interface with the physics engines. As a physics Entity should be able to have mulitple shapes connected to it. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 8c8204a..681bb46 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -167,18 +167,6 @@ namespace OpenSim.Framework.Servers return response; } - protected virtual string ParseLLSDXML(string requestBody) - { - // dummy function for now - IMPLEMENT ME! - //Console.WriteLine("LLSD request "+requestBody); - string resp = ""; - if (firstcaps) - { - resp = "MapLayerhttp://127.0.0.1:9000/CAPS/"; - firstcaps = false; - } - return resp; - } protected virtual string ParseXMLRPC(string requestBody) { -- cgit v1.1 From fcabdab7bc7466a8a56c0f034c56ca22124e8060 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 2 Jul 2007 16:03:58 +0000 Subject: * Started working on LlsdMethod for BaseHttpServer *Renamed IRestHandler.cs to RestMethod.cs which is the correct name. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 8 +---- OpenSim/Framework/Servers/IRestHandler.cs | 35 ------------------ OpenSim/Framework/Servers/LlsdMethod.cs | 8 +++++ .../Servers/OpenSim.Framework.Servers.csproj | 41 +++++++++++++--------- .../Servers/OpenSim.Framework.Servers.dll.build | 2 +- OpenSim/Framework/Servers/RestMethod.cs | 35 ++++++++++++++++++ 6 files changed, 70 insertions(+), 59 deletions(-) delete mode 100644 OpenSim/Framework/Servers/IRestHandler.cs create mode 100644 OpenSim/Framework/Servers/LlsdMethod.cs create mode 100644 OpenSim/Framework/Servers/RestMethod.cs (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 681bb46..0442b1a 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -224,15 +224,9 @@ namespace OpenSim.Framework.Servers break; case "application/xml": - // probably LLSD we hope, otherwise it should be ignored by the parser - // responseString = ParseLLSDXML(requestBody); - responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - response.AddHeader("Content-type", "application/xml"); - break; - case "application/octet-stream": // probably LLSD we hope, otherwise it should be ignored by the parser - // responseString = ParseLLSDXML(requestBody); + // responseString = ParseLLSDXML(requestBody); responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); response.AddHeader("Content-type", "application/xml"); break; diff --git a/OpenSim/Framework/Servers/IRestHandler.cs b/OpenSim/Framework/Servers/IRestHandler.cs deleted file mode 100644 index a2b6bf0..0000000 --- a/OpenSim/Framework/Servers/IRestHandler.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.Servers -{ - public delegate string RestMethod( string request, string path, string param ); -} diff --git a/OpenSim/Framework/Servers/LlsdMethod.cs b/OpenSim/Framework/Servers/LlsdMethod.cs new file mode 100644 index 0000000..4ce4287 --- /dev/null +++ b/OpenSim/Framework/Servers/LlsdMethod.cs @@ -0,0 +1,8 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Servers +{ + public delegate string LlsdMethod(string request, string path, string param); +} diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 399f456..d6d0815 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {2CC71860-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Framework.Servers @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Framework.Servers - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,22 +61,24 @@ False False 4 - + + - + ..\..\..\bin\libsecondlife.dll False - + System.dll False - + + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -80,13 +88,13 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -96,7 +104,8 @@ Code - + + Code @@ -113,4 +122,4 @@ - + \ No newline at end of file diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index 7401b07..60b204d 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -13,7 +13,7 @@ - + diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs new file mode 100644 index 0000000..a2b6bf0 --- /dev/null +++ b/OpenSim/Framework/Servers/RestMethod.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Servers +{ + public delegate string RestMethod( string request, string path, string param ); +} -- cgit v1.1 From 71f1b2d87803e4fb3a0fb5a12d1e9a2f4287b6fa Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 2 Jul 2007 20:44:39 +0000 Subject: * Added conceptual LlsdMethod Demo to SimpleApp (work in progress) --- OpenSim/Framework/Servers/BaseHttpServer.cs | 5 +++ OpenSim/Framework/Servers/LlsdMethod.cs | 3 +- .../Servers/OpenSim.Framework.Servers.csproj | 42 ++++++++++------------ .../Servers/OpenSim.Framework.Servers.dll.build | 1 + 4 files changed, 26 insertions(+), 25 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 0442b1a..5dc1f56 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -289,5 +289,10 @@ namespace OpenSim.Framework.Servers OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.MEDIUM, e.Message); } } + + public void AddLlsdMethod(string path, LlsdMethod handler ) + { + throw new Exception("The method or operation is not implemented."); + } } } diff --git a/OpenSim/Framework/Servers/LlsdMethod.cs b/OpenSim/Framework/Servers/LlsdMethod.cs index 4ce4287..c66873f 100644 --- a/OpenSim/Framework/Servers/LlsdMethod.cs +++ b/OpenSim/Framework/Servers/LlsdMethod.cs @@ -4,5 +4,6 @@ using System.Text; namespace OpenSim.Framework.Servers { - public delegate string LlsdMethod(string request, string path, string param); + public delegate object LlsdMethod(object request, string path, string param); + public delegate TResponse LlsdMethod( TRequest request ); } diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index d6d0815..38d611e 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,8 +6,7 @@ {2CC71860-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.Framework.Servers @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.Framework.Servers - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,24 +55,22 @@ False False 4 - - + - + ..\..\..\bin\libsecondlife.dll False - + System.dll False - - + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -88,13 +80,13 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -104,7 +96,9 @@ Code - + + Code + Code @@ -122,4 +116,4 @@ - \ No newline at end of file + diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index 60b204d..6640a29 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -13,6 +13,7 @@ + -- cgit v1.1 From 73a5ec391aa5600cb779044fbf335ce0537e9500 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 3 Jul 2007 07:06:08 +0000 Subject: * Completed conceptual LlsdMethod - everything resides in SimpleApp pending guru approval. --- OpenSim/Framework/Servers/ILlsdMethodHandler.cs | 13 +++++++++++++ OpenSim/Framework/Servers/LlsdMethod.cs | 1 - OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj | 3 +++ .../Framework/Servers/OpenSim.Framework.Servers.dll.build | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Framework/Servers/ILlsdMethodHandler.cs (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/ILlsdMethodHandler.cs b/OpenSim/Framework/Servers/ILlsdMethodHandler.cs new file mode 100644 index 0000000..f5daa8d --- /dev/null +++ b/OpenSim/Framework/Servers/ILlsdMethodHandler.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Servers +{ + public interface ILlsdMethodHandler + { + string Handle(string request, string path); + } + + +} diff --git a/OpenSim/Framework/Servers/LlsdMethod.cs b/OpenSim/Framework/Servers/LlsdMethod.cs index c66873f..bf58a71 100644 --- a/OpenSim/Framework/Servers/LlsdMethod.cs +++ b/OpenSim/Framework/Servers/LlsdMethod.cs @@ -4,6 +4,5 @@ using System.Text; namespace OpenSim.Framework.Servers { - public delegate object LlsdMethod(object request, string path, string param); public delegate TResponse LlsdMethod( TRequest request ); } diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 38d611e..909bd62 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -96,6 +96,9 @@ Code + + Code + Code diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index 6640a29..22d98dc 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -13,6 +13,7 @@ + -- cgit v1.1 From 9b6b6d05d45cf0f754a0b26bf6240ef50be66563 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 3 Jul 2007 14:37:29 +0000 Subject: * Optimized usings (the 'LL ate my scripts' commit) * added some licensing info --- OpenSim/Framework/Servers/BaseHttpServer.cs | 19 ++++++++-------- OpenSim/Framework/Servers/CheckSumServer.cs | 15 ------------- OpenSim/Framework/Servers/ILlsdMethodHandler.cs | 30 ++++++++++++++++++++++--- OpenSim/Framework/Servers/LlsdMethod.cs | 30 ++++++++++++++++++++++--- OpenSim/Framework/Servers/RestMethod.cs | 4 ---- OpenSim/Framework/Servers/UDPServerBase.cs | 8 ------- OpenSim/Framework/Servers/XmlRpcMethod.cs | 1 - 7 files changed, 64 insertions(+), 43 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 5dc1f56..713793c 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -26,13 +26,14 @@ * */ using System; +using System.Collections; using System.Collections.Generic; +using System.IO; using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Threading; using Nwc.XmlRpc; -using System.Collections; using OpenSim.Framework.Console; namespace OpenSim.Framework.Servers @@ -199,9 +200,9 @@ namespace OpenSim.Framework.Servers response.KeepAlive = false; response.SendChunked = false; - System.IO.Stream body = request.InputStream; - System.Text.Encoding encoding = System.Text.Encoding.UTF8; - System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); + Stream body = request.InputStream; + Encoding encoding = Encoding.UTF8; + StreamReader reader = new StreamReader(body, encoding); string requestBody = reader.ReadToEnd(); body.Close(); @@ -245,8 +246,8 @@ namespace OpenSim.Framework.Servers } - byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); - System.IO.Stream output = response.OutputStream; + byte[] buffer = Encoding.UTF8.GetBytes(responseString); + Stream output = response.OutputStream; response.SendChunked = false; response.ContentLength64 = buffer.Length; output.Write(buffer, 0, buffer.Length); @@ -260,7 +261,7 @@ namespace OpenSim.Framework.Servers public void Start() { - OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: Starting up HTTP Server"); + MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: Starting up HTTP Server"); m_workerThread = new Thread(new ThreadStart(StartHTTP)); m_workerThread.IsBackground = true; @@ -271,7 +272,7 @@ namespace OpenSim.Framework.Servers { try { - OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: StartHTTP() - Spawned main thread OK"); + MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: StartHTTP() - Spawned main thread OK"); m_httpListener = new HttpListener(); m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); @@ -286,7 +287,7 @@ namespace OpenSim.Framework.Servers } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.WriteLine(LogPriority.MEDIUM, e.Message); + MainLog.Instance.WriteLine(LogPriority.MEDIUM, e.Message); } } diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs index 6aeb58c..104de94 100644 --- a/OpenSim/Framework/Servers/CheckSumServer.cs +++ b/OpenSim/Framework/Servers/CheckSumServer.cs @@ -25,21 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Text; -using System.IO; -using System.Threading; -using System.Net; -using System.Net.Sockets; -using System.Timers; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Console; - - namespace OpenSim.Framework.Servers { /* public class CheckSumServer : UDPServerBase diff --git a/OpenSim/Framework/Servers/ILlsdMethodHandler.cs b/OpenSim/Framework/Servers/ILlsdMethodHandler.cs index f5daa8d..5382f2d 100644 --- a/OpenSim/Framework/Servers/ILlsdMethodHandler.cs +++ b/OpenSim/Framework/Servers/ILlsdMethodHandler.cs @@ -1,6 +1,30 @@ -using System; -using System.Collections.Generic; -using System.Text; +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ namespace OpenSim.Framework.Servers { diff --git a/OpenSim/Framework/Servers/LlsdMethod.cs b/OpenSim/Framework/Servers/LlsdMethod.cs index bf58a71..d17fa38 100644 --- a/OpenSim/Framework/Servers/LlsdMethod.cs +++ b/OpenSim/Framework/Servers/LlsdMethod.cs @@ -1,6 +1,30 @@ -using System; -using System.Collections.Generic; -using System.Text; +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ namespace OpenSim.Framework.Servers { diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs index a2b6bf0..c6cb230 100644 --- a/OpenSim/Framework/Servers/RestMethod.cs +++ b/OpenSim/Framework/Servers/RestMethod.cs @@ -25,10 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Framework.Servers { public delegate string RestMethod( string request, string path, string param ); diff --git a/OpenSim/Framework/Servers/UDPServerBase.cs b/OpenSim/Framework/Servers/UDPServerBase.cs index 2617c56..508eb9d 100644 --- a/OpenSim/Framework/Servers/UDPServerBase.cs +++ b/OpenSim/Framework/Servers/UDPServerBase.cs @@ -26,16 +26,8 @@ * */ using System; -using System.Text; -using System.IO; -using System.Threading; using System.Net; using System.Net.Sockets; -using System.Timers; -using System.Reflection; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; using libsecondlife.Packets; namespace OpenSim.Framework.Servers diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs index 51b3303..b76ac51 100644 --- a/OpenSim/Framework/Servers/XmlRpcMethod.cs +++ b/OpenSim/Framework/Servers/XmlRpcMethod.cs @@ -25,7 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; using Nwc.XmlRpc; namespace OpenSim.Framework.Servers -- cgit v1.1 From bd8018fa1cb32aa42e2a1a41ebb01fc0f1b0a04b Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 3 Jul 2007 20:10:20 +0000 Subject: Today's work on Building support/tools. Think I am slowly getting there. --- OpenSim/Framework/Servers/CheckSumServer.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs index 104de94..89ec095 100644 --- a/OpenSim/Framework/Servers/CheckSumServer.cs +++ b/OpenSim/Framework/Servers/CheckSumServer.cs @@ -26,8 +26,8 @@ * */ namespace OpenSim.Framework.Servers -{ -/* public class CheckSumServer : UDPServerBase +{/* + public class CheckSumServer : UDPServerBase { //protected ConsoleBase m_log; @@ -121,6 +121,7 @@ namespace OpenSim.Framework.Servers { this.Server.SendTo(buffer, size, flags, endp); } - * - }*/ + * } + */ + } \ No newline at end of file -- cgit v1.1 From 8b3cb93b49b21b7729adc56a9c06658fb94b1e8f Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 4 Jul 2007 04:29:23 +0000 Subject: * Started work on converting BaseHttpServer to a stream dispatcher --- OpenSim/Framework/Servers/BaseHttpServer.cs | 164 +++++++++++++-------- OpenSim/Framework/Servers/IStreamHandler.cs | 12 ++ .../Servers/OpenSim.Framework.Servers.csproj | 40 +++-- OpenSim/Framework/Servers/RestStreamHandler.cs | 15 ++ 4 files changed, 155 insertions(+), 76 deletions(-) create mode 100644 OpenSim/Framework/Servers/IStreamHandler.cs create mode 100644 OpenSim/Framework/Servers/RestStreamHandler.cs (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 713793c..81028b0 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers protected HttpListener m_httpListener; protected Dictionary m_restHandlers = new Dictionary(); protected Dictionary m_rpcHandlers = new Dictionary(); + protected Dictionary m_streamHandlers = new Dictionary(); protected int m_port; protected bool firstcaps = true; @@ -73,9 +74,14 @@ namespace OpenSim.Framework.Servers m_port = port; } + private void AddStreamHandler(string path, IStreamHandler handler) + { + m_streamHandlers.Add(path, handler); + } + public bool AddRestHandler(string method, string path, RestMethod handler) { - //Console.WriteLine("adding new REST handler for path " + path); + //Console.WriteLine("adding new REST handler for path " + path); string methodKey = String.Format("{0}: {1}", method, path); if (!this.m_restHandlers.ContainsKey(methodKey)) @@ -190,75 +196,115 @@ namespace OpenSim.Framework.Servers public virtual void HandleRequest(Object stateinfo) { - try - { - HttpListenerContext context = (HttpListenerContext)stateinfo; + HttpListenerContext context = (HttpListenerContext)stateinfo; - HttpListenerRequest request = context.Request; - HttpListenerResponse response = context.Response; + HttpListenerRequest request = context.Request; + HttpListenerResponse response = context.Response; - response.KeepAlive = false; - response.SendChunked = false; + response.KeepAlive = false; + response.SendChunked = false; - Stream body = request.InputStream; - Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(body, encoding); + string path = request.RawUrl; - string requestBody = reader.ReadToEnd(); - body.Close(); - reader.Close(); + IStreamHandler streamHandler; - //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType); - //Console.WriteLine(requestBody); - - string responseString = ""; - // Console.WriteLine("new request " + request.ContentType +" at "+ request.RawUrl); - switch (request.ContentType) - { - case "text/xml": - // must be XML-RPC, so pass to the XML-RPC parser - - responseString = ParseXMLRPC(requestBody); - responseString = Regex.Replace(responseString, "utf-16", "utf-8"); - - response.AddHeader("Content-type", "text/xml"); - break; - - case "application/xml": - case "application/octet-stream": - // probably LLSD we hope, otherwise it should be ignored by the parser - // responseString = ParseLLSDXML(requestBody); - responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - response.AddHeader("Content-type", "application/xml"); - break; - - case "application/x-www-form-urlencoded": - // a form data POST so send to the REST parser - responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - response.AddHeader("Content-type", "text/html"); - break; - - case null: - // must be REST or invalid crap, so pass to the REST parser - responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - response.AddHeader("Content-type", "text/html"); - break; + if(TryGetStreamHandler(path, out streamHandler)) + { + streamHandler.Handle(path, request.InputStream, response.OutputStream ); + } + else + { + HandleLegacyRequests(request, response); + } + } + private bool TryGetStreamHandler(string path, out IStreamHandler streamHandler ) + { + string bestMatch = null; + + foreach (string pattern in m_streamHandlers.Keys) + { + if (path.StartsWith(pattern)) + { + if (String.IsNullOrEmpty( bestMatch ) || pattern.Length > bestMatch.Length) + { + bestMatch = pattern; + } } + } - byte[] buffer = Encoding.UTF8.GetBytes(responseString); - Stream output = response.OutputStream; - response.SendChunked = false; - response.ContentLength64 = buffer.Length; - output.Write(buffer, 0, buffer.Length); - output.Close(); + if( String.IsNullOrEmpty( bestMatch ) ) + { + streamHandler = null; + return false; } - catch (Exception e) + else { - //Console.WriteLine(e.ToString()); + streamHandler = m_streamHandlers[bestMatch]; + return true; } } + private void HandleLegacyRequests(HttpListenerRequest request, HttpListenerResponse response) + { + Stream body = request.InputStream; + + Encoding encoding = Encoding.UTF8; + StreamReader reader = new StreamReader(body, encoding); + + string requestBody = reader.ReadToEnd(); + body.Close(); + reader.Close(); + + //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType); + //Console.WriteLine(requestBody); + + string responseString = ""; + // Console.WriteLine("new request " + request.ContentType +" at "+ request.RawUrl); + switch (request.ContentType) + { + case "text/xml": + // must be XML-RPC, so pass to the XML-RPC parser + + responseString = ParseXMLRPC(requestBody); + responseString = Regex.Replace(responseString, "utf-16", "utf-8"); + + response.AddHeader("Content-type", "text/xml"); + break; + + case "application/xml": + case "application/octet-stream": + // probably LLSD we hope, otherwise it should be ignored by the parser + // responseString = ParseLLSDXML(requestBody); + responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + response.AddHeader("Content-type", "application/xml"); + break; + + case "application/x-www-form-urlencoded": + // a form data POST so send to the REST parser + responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + response.AddHeader("Content-type", "text/html"); + break; + + case null: + // must be REST or invalid crap, so pass to the REST parser + responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + response.AddHeader("Content-type", "text/html"); + break; + + } + + byte[] buffer = Encoding.UTF8.GetBytes(responseString); + Stream output = response.OutputStream; + response.SendChunked = false; + response.ContentLength64 = buffer.Length; + + + + output.Write(buffer, 0, buffer.Length); + output.Close(); + } + public void Start() { MainLog.Instance.WriteLine(LogPriority.LOW, "BaseHttpServer.cs: Starting up HTTP Server"); @@ -291,9 +337,5 @@ namespace OpenSim.Framework.Servers } } - public void AddLlsdMethod(string path, LlsdMethod handler ) - { - throw new Exception("The method or operation is not implemented."); - } } } diff --git a/OpenSim/Framework/Servers/IStreamHandler.cs b/OpenSim/Framework/Servers/IStreamHandler.cs new file mode 100644 index 0000000..88ae641 --- /dev/null +++ b/OpenSim/Framework/Servers/IStreamHandler.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace OpenSim.Framework.Servers +{ + public interface IStreamHandler + { + void Handle(string path, Stream request, Stream response); + } +} diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 909bd62..956a9bc 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {2CC71860-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Framework.Servers @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Framework.Servers - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,22 +61,24 @@ False False 4 - + + - + ..\..\..\bin\libsecondlife.dll False - + System.dll False - + + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -80,13 +88,13 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -99,12 +107,14 @@ Code + Code Code + Code @@ -119,4 +129,4 @@ - + \ No newline at end of file diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs new file mode 100644 index 0000000..145a184 --- /dev/null +++ b/OpenSim/Framework/Servers/RestStreamHandler.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace OpenSim.Framework.Servers +{ + public class RestStreamHandler : IStreamHandler + { + public void Handle( string path, Stream request, Stream response ) + { + + } + } +} -- cgit v1.1 From daf7b8ec76bb333d4808e8cd4392a002042ac2d0 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 4 Jul 2007 05:25:40 +0000 Subject: * Cleaning - attempting to get compiler warnings back down to zero. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 81028b0..8fa577c 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -187,7 +187,7 @@ namespace OpenSim.Framework.Servers responseString = ProcessXMLRPCMethod(methodName, request); } - catch (Exception e) + catch { //Console.WriteLine(e.ToString()); } -- cgit v1.1 From 9a51949cb4c833dcacf2a5803a8f2753273941c8 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 4 Jul 2007 11:47:32 +0000 Subject: * Added StreamHandler support * Implemented RestStreamHandler * Some caps functions now use it * Moved out RestMethodEntry from httpserver * The IStreamHandler interface now reports required method and Content-Type --- OpenSim/Framework/Servers/BaseHttpServer.cs | 63 ++++++++-------------- OpenSim/Framework/Servers/IStreamHandler.cs | 9 +++- .../Servers/OpenSim.Framework.Servers.csproj | 49 +++++++++-------- .../Servers/OpenSim.Framework.Servers.dll.build | 3 ++ OpenSim/Framework/Servers/RestMethodEntry.cs | 27 ++++++++++ OpenSim/Framework/Servers/RestStreamHandler.cs | 34 +++++++++++- 6 files changed, 116 insertions(+), 69 deletions(-) create mode 100644 OpenSim/Framework/Servers/RestMethodEntry.cs (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 8fa577c..9831108 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -40,27 +40,6 @@ namespace OpenSim.Framework.Servers { public class BaseHttpServer { - protected class RestMethodEntry - { - private string m_path; - public string Path - { - get { return m_path; } - } - - private RestMethod m_restMethod; - public RestMethod RestMethod - { - get { return m_restMethod; } - } - - public RestMethodEntry(string path, RestMethod restMethod) - { - m_path = path; - m_restMethod = restMethod; - } - } - protected Thread m_workerThread; protected HttpListener m_httpListener; protected Dictionary m_restHandlers = new Dictionary(); @@ -74,9 +53,10 @@ namespace OpenSim.Framework.Servers m_port = port; } - private void AddStreamHandler(string path, IStreamHandler handler) + public void AddStreamHandler( string path, IStreamHandler handler) { - m_streamHandlers.Add(path, handler); + string handlerKey = handler.HttpMethod + ":" + path; + m_streamHandlers.Add(handlerKey, handler); } public bool AddRestHandler(string method, string path, RestMethod handler) @@ -179,18 +159,12 @@ namespace OpenSim.Framework.Servers { string responseString = String.Empty; - try - { - XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); + XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); - string methodName = request.MethodName; + string methodName = request.MethodName; + + responseString = ProcessXMLRPCMethod(methodName, request); - responseString = ProcessXMLRPCMethod(methodName, request); - } - catch - { - //Console.WriteLine(e.ToString()); - } return responseString; } @@ -205,12 +179,19 @@ namespace OpenSim.Framework.Servers response.SendChunked = false; string path = request.RawUrl; + string handlerKey = request.HttpMethod + ":" + path; IStreamHandler streamHandler; - if(TryGetStreamHandler(path, out streamHandler)) + if (TryGetStreamHandler( handlerKey, out streamHandler)) { - streamHandler.Handle(path, request.InputStream, response.OutputStream ); + byte[] buffer = streamHandler.Handle(path, request.InputStream ); + request.InputStream.Close(); + + response.ContentType = streamHandler.ContentType; + response.ContentLength64 = buffer.LongLength; + response.OutputStream.Write(buffer, 0, buffer.Length); + response.OutputStream.Close(); } else { @@ -218,22 +199,22 @@ namespace OpenSim.Framework.Servers } } - private bool TryGetStreamHandler(string path, out IStreamHandler streamHandler ) + private bool TryGetStreamHandler(string handlerKey, out IStreamHandler streamHandler) { string bestMatch = null; - + foreach (string pattern in m_streamHandlers.Keys) { - if (path.StartsWith(pattern)) - { - if (String.IsNullOrEmpty( bestMatch ) || pattern.Length > bestMatch.Length) + if (handlerKey.StartsWith(pattern)) + { + if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) { bestMatch = pattern; } } } - if( String.IsNullOrEmpty( bestMatch ) ) + if (String.IsNullOrEmpty(bestMatch)) { streamHandler = null; return false; diff --git a/OpenSim/Framework/Servers/IStreamHandler.cs b/OpenSim/Framework/Servers/IStreamHandler.cs index 88ae641..bc76e9c 100644 --- a/OpenSim/Framework/Servers/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/IStreamHandler.cs @@ -7,6 +7,13 @@ namespace OpenSim.Framework.Servers { public interface IStreamHandler { - void Handle(string path, Stream request, Stream response); + // Handle request stream, return byte array + byte[] Handle(string path, Stream request ); + + // Return response content type + string ContentType { get; } + + // Return required http method + string HttpMethod { get;} } } diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 956a9bc..555bd5d 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,8 +6,7 @@ {2CC71860-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.Framework.Servers @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.Framework.Servers - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,24 +55,22 @@ False False 4 - - + - + ..\..\..\bin\libsecondlife.dll False - + System.dll False - - + System.Xml.dll False - + ..\..\..\bin\XMLRPC.dll False @@ -88,13 +80,13 @@ OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -107,14 +99,21 @@ Code - + + Code + Code Code - + + Code + + + Code + Code @@ -129,4 +128,4 @@ - \ No newline at end of file + diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index 22d98dc..a3d140f 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -14,8 +14,11 @@ + + + diff --git a/OpenSim/Framework/Servers/RestMethodEntry.cs b/OpenSim/Framework/Servers/RestMethodEntry.cs new file mode 100644 index 0000000..ab926e0 --- /dev/null +++ b/OpenSim/Framework/Servers/RestMethodEntry.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Servers +{ + public class RestMethodEntry + { + private string m_path; + public string Path + { + get { return m_path; } + } + + private RestMethod m_restMethod; + public RestMethod RestMethod + { + get { return m_restMethod; } + } + + public RestMethodEntry(string path, RestMethod restMethod) + { + m_path = path; + m_restMethod = restMethod; + } + } +} diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs index 145a184..64d6ea3 100644 --- a/OpenSim/Framework/Servers/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/RestStreamHandler.cs @@ -7,9 +7,39 @@ namespace OpenSim.Framework.Servers { public class RestStreamHandler : IStreamHandler { - public void Handle( string path, Stream request, Stream response ) + RestMethod m_restMethod; + + private string m_contentType; + public string ContentType + { + get { return m_contentType; } + } + + private string m_httpMethod; + public string HttpMethod + { + get { return m_httpMethod; } + } + + + public byte[] Handle(string path, Stream request ) + { + Encoding encoding = Encoding.UTF8; + StreamReader reader = new StreamReader(request, encoding); + + string requestBody = reader.ReadToEnd(); + reader.Close(); + + string responseString = m_restMethod(requestBody, path, m_httpMethod); + + return Encoding.UTF8.GetBytes(responseString); + } + + public RestStreamHandler(RestMethod restMethod, string httpMethod, string contentType) { - + m_restMethod = restMethod; + m_httpMethod = httpMethod; + m_contentType = contentType; } } } -- cgit v1.1 From 6a2588454a1ac4bb484ad0b9ee648e9ac156f8db Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 4 Jul 2007 14:12:32 +0000 Subject: * Removed AssetHttpServer, using BaseHttpServer instead * Removed legacy REST handling * Created two custom IStreamHandlers for asset up/download * Removed quite a lot of double and triple encodings, trying to work towards binary only and direct write into storage. * Introduced BaseStreamHandler with GetParam() and some other goodies --- OpenSim/Framework/Servers/BaseHttpServer.cs | 163 +++++++++++---------- OpenSim/Framework/Servers/BaseStreamHandler.cs | 40 +++++ OpenSim/Framework/Servers/IStreamHandler.cs | 3 + .../Servers/OpenSim.Framework.Servers.csproj | 3 + .../Servers/OpenSim.Framework.Servers.dll.build | 1 + OpenSim/Framework/Servers/RestStreamHandler.cs | 30 +--- 6 files changed, 143 insertions(+), 97 deletions(-) create mode 100644 OpenSim/Framework/Servers/BaseStreamHandler.cs (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 9831108..aed538b 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -42,48 +42,56 @@ namespace OpenSim.Framework.Servers { protected Thread m_workerThread; protected HttpListener m_httpListener; - protected Dictionary m_restHandlers = new Dictionary(); + //protected Dictionary m_restHandlers = new Dictionary(); protected Dictionary m_rpcHandlers = new Dictionary(); protected Dictionary m_streamHandlers = new Dictionary(); protected int m_port; - protected bool firstcaps = true; + protected bool m_firstcaps = true; public BaseHttpServer(int port) { m_port = port; } - public void AddStreamHandler( string path, IStreamHandler handler) + public void AddStreamHandler( IStreamHandler handler) { - string handlerKey = handler.HttpMethod + ":" + path; + string httpMethod = handler.HttpMethod; + string path = handler.Path; + + string handlerKey = GetHandlerKey(httpMethod, path); m_streamHandlers.Add(handlerKey, handler); } - public bool AddRestHandler(string method, string path, RestMethod handler) + private static string GetHandlerKey(string httpMethod, string path) { - //Console.WriteLine("adding new REST handler for path " + path); - string methodKey = String.Format("{0}: {1}", method, path); - - if (!this.m_restHandlers.ContainsKey(methodKey)) - { - this.m_restHandlers.Add(methodKey, new RestMethodEntry(path, handler)); - return true; - } - - //must already have a handler for that path so return false - return false; + return httpMethod + ":" + path; } - public bool RemoveRestHandler(string method, string path) - { - string methodKey = String.Format("{0}: {1}", method, path); - if (this.m_restHandlers.ContainsKey(methodKey)) - { - this.m_restHandlers.Remove(methodKey); - return true; - } - return false; - } + //public bool AddRestHandler(string method, string path, RestMethod handler) + //{ + // //Console.WriteLine("adding new REST handler for path " + path); + // string methodKey = String.Format("{0}: {1}", method, path); + + // if (!this.m_restHandlers.ContainsKey(methodKey)) + // { + // this.m_restHandlers.Add(methodKey, new RestMethodEntry(path, handler)); + // return true; + // } + + // //must already have a handler for that path so return false + // return false; + //} + + //public bool RemoveRestHandler(string method, string path) + //{ + // string methodKey = String.Format("{0}: {1}", method, path); + // if (this.m_restHandlers.ContainsKey(methodKey)) + // { + // this.m_restHandlers.Remove(methodKey); + // return true; + // } + // return false; + //} public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) { @@ -119,40 +127,40 @@ namespace OpenSim.Framework.Servers return XmlRpcResponseSerializer.Singleton.Serialize(response); } - protected virtual string ParseREST(string request, string path, string method) - { - string response; + //protected virtual string ParseREST(string request, string path, string method) + //{ + // string response; - string requestKey = String.Format("{0}: {1}", method, path); + // string requestKey = String.Format("{0}: {1}", method, path); - string bestMatch = String.Empty; - foreach (string currentKey in m_restHandlers.Keys) - { - if (requestKey.StartsWith(currentKey)) - { - if (currentKey.Length > bestMatch.Length) - { - bestMatch = currentKey; - } - } - } + // string bestMatch = String.Empty; + // foreach (string currentKey in m_restHandlers.Keys) + // { + // if (requestKey.StartsWith(currentKey)) + // { + // if (currentKey.Length > bestMatch.Length) + // { + // bestMatch = currentKey; + // } + // } + // } - RestMethodEntry restMethodEntry; - if (m_restHandlers.TryGetValue(bestMatch, out restMethodEntry)) - { - RestMethod restMethod = restMethodEntry.RestMethod; + // RestMethodEntry restMethodEntry; + // if (m_restHandlers.TryGetValue(bestMatch, out restMethodEntry)) + // { + // RestMethod restMethod = restMethodEntry.RestMethod; - string param = path.Substring(restMethodEntry.Path.Length); - response = restMethod(request, path, param); + // string param = path.Substring(restMethodEntry.Path.Length); + // response = restMethod(request, path, param); - } - else - { - response = String.Empty; - } + // } + // else + // { + // response = String.Empty; + // } - return response; - } + // return response; + //} protected virtual string ParseXMLRPC(string requestBody) @@ -179,13 +187,13 @@ namespace OpenSim.Framework.Servers response.SendChunked = false; string path = request.RawUrl; - string handlerKey = request.HttpMethod + ":" + path; + string handlerKey = GetHandlerKey( request.HttpMethod, path ); IStreamHandler streamHandler; if (TryGetStreamHandler( handlerKey, out streamHandler)) { - byte[] buffer = streamHandler.Handle(path, request.InputStream ); + byte[] buffer = streamHandler.Handle(path, request.InputStream); request.InputStream.Close(); response.ContentType = streamHandler.ContentType; @@ -253,25 +261,25 @@ namespace OpenSim.Framework.Servers response.AddHeader("Content-type", "text/xml"); break; - case "application/xml": - case "application/octet-stream": - // probably LLSD we hope, otherwise it should be ignored by the parser - // responseString = ParseLLSDXML(requestBody); - responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - response.AddHeader("Content-type", "application/xml"); - break; - - case "application/x-www-form-urlencoded": - // a form data POST so send to the REST parser - responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - response.AddHeader("Content-type", "text/html"); - break; - - case null: - // must be REST or invalid crap, so pass to the REST parser - responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - response.AddHeader("Content-type", "text/html"); - break; + //case "application/xml": + //case "application/octet-stream": + // // probably LLSD we hope, otherwise it should be ignored by the parser + // // responseString = ParseLLSDXML(requestBody); + // responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + // response.AddHeader("Content-type", "application/xml"); + // break; + + //case "application/x-www-form-urlencoded": + // // a form data POST so send to the REST parser + // responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + // response.AddHeader("Content-type", "text/html"); + // break; + + //case null: + // // must be REST or invalid crap, so pass to the REST parser + // responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); + // response.AddHeader("Content-type", "text/html"); + // break; } @@ -318,5 +326,10 @@ namespace OpenSim.Framework.Servers } } + + public void RemoveStreamHandler(string httpMethod, string path) + { + m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); + } } } diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs new file mode 100644 index 0000000..95e9707 --- /dev/null +++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace OpenSim.Framework.Servers +{ + public abstract class BaseStreamHandler : IStreamHandler + { + public string ContentType + { + get { return "application/xml"; } + } + + private string m_httpMethod; + public string HttpMethod + { + get { return m_httpMethod; } + } + + private string m_path; + public string Path + { + get { return m_path; } + } + + protected string GetParam( string path ) + { + return path.Substring( m_path.Length ); + } + + public abstract byte[] Handle(string path, Stream request); + + protected BaseStreamHandler(string path, string httpMethod ) + { + m_httpMethod = httpMethod; + m_path = path; + } + } +} diff --git a/OpenSim/Framework/Servers/IStreamHandler.cs b/OpenSim/Framework/Servers/IStreamHandler.cs index bc76e9c..6cab40d 100644 --- a/OpenSim/Framework/Servers/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/IStreamHandler.cs @@ -15,5 +15,8 @@ namespace OpenSim.Framework.Servers // Return required http method string HttpMethod { get;} + + // Return path + string Path { get; } } } diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 555bd5d..4eb9844 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -93,6 +93,9 @@ Code + + Code + Code diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index a3d140f..5e96ef1 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -12,6 +12,7 @@ + diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs index 64d6ea3..7ca369d 100644 --- a/OpenSim/Framework/Servers/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/RestStreamHandler.cs @@ -5,41 +5,27 @@ using System.IO; namespace OpenSim.Framework.Servers { - public class RestStreamHandler : IStreamHandler + public class RestStreamHandler : BaseStreamHandler { RestMethod m_restMethod; - private string m_contentType; - public string ContentType - { - get { return m_contentType; } - } - - private string m_httpMethod; - public string HttpMethod - { - get { return m_httpMethod; } - } - - - public byte[] Handle(string path, Stream request ) + override public byte[] Handle(string path, Stream request ) { Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(request, encoding); + StreamReader streamReader = new StreamReader(request, encoding); - string requestBody = reader.ReadToEnd(); - reader.Close(); + string requestBody = streamReader.ReadToEnd(); + streamReader.Close(); - string responseString = m_restMethod(requestBody, path, m_httpMethod); + string param = GetParam(path); + string responseString = m_restMethod(requestBody, path, param ); return Encoding.UTF8.GetBytes(responseString); } - public RestStreamHandler(RestMethod restMethod, string httpMethod, string contentType) + public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( path, httpMethod ) { m_restMethod = restMethod; - m_httpMethod = httpMethod; - m_contentType = contentType; } } } -- cgit v1.1 From 5c32b33a66fbdf371d53d85ee54ee8e837481570 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 4 Jul 2007 16:28:59 +0000 Subject: * re-fixed the utf-16 bug in xmlRpcResponse serialization * added LLSDStreamHandler.cs to Caps (Haven't enabled it yet, though) * removed last traces of old rest handling --- OpenSim/Framework/Servers/BaseHttpServer.cs | 175 ++++----------------- OpenSim/Framework/Servers/BaseStreamHandler.cs | 6 +- OpenSim/Framework/Servers/ILlsdMethodHandler.cs | 37 ----- OpenSim/Framework/Servers/LlsdMethod.cs | 32 ---- .../Servers/OpenSim.Framework.Servers.csproj | 9 -- .../Servers/OpenSim.Framework.Servers.dll.build | 3 - OpenSim/Framework/Servers/RestMethodEntry.cs | 27 ---- 7 files changed, 37 insertions(+), 252 deletions(-) delete mode 100644 OpenSim/Framework/Servers/ILlsdMethodHandler.cs delete mode 100644 OpenSim/Framework/Servers/LlsdMethod.cs delete mode 100644 OpenSim/Framework/Servers/RestMethodEntry.cs (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index aed538b..84af9f6 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -42,7 +42,6 @@ namespace OpenSim.Framework.Servers { protected Thread m_workerThread; protected HttpListener m_httpListener; - //protected Dictionary m_restHandlers = new Dictionary(); protected Dictionary m_rpcHandlers = new Dictionary(); protected Dictionary m_streamHandlers = new Dictionary(); protected int m_port; @@ -67,32 +66,6 @@ namespace OpenSim.Framework.Servers return httpMethod + ":" + path; } - //public bool AddRestHandler(string method, string path, RestMethod handler) - //{ - // //Console.WriteLine("adding new REST handler for path " + path); - // string methodKey = String.Format("{0}: {1}", method, path); - - // if (!this.m_restHandlers.ContainsKey(methodKey)) - // { - // this.m_restHandlers.Add(methodKey, new RestMethodEntry(path, handler)); - // return true; - // } - - // //must already have a handler for that path so return false - // return false; - //} - - //public bool RemoveRestHandler(string method, string path) - //{ - // string methodKey = String.Format("{0}: {1}", method, path); - // if (this.m_restHandlers.ContainsKey(methodKey)) - // { - // this.m_restHandlers.Remove(methodKey); - // return true; - // } - // return false; - //} - public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) { if (!this.m_rpcHandlers.ContainsKey(method)) @@ -105,76 +78,6 @@ namespace OpenSim.Framework.Servers return false; } - protected virtual string ProcessXMLRPCMethod(string methodName, XmlRpcRequest request) - { - XmlRpcResponse response; - - XmlRpcMethod method; - if (this.m_rpcHandlers.TryGetValue(methodName, out method)) - { - response = method(request); - } - else - { - response = new XmlRpcResponse(); - Hashtable unknownMethodError = new Hashtable(); - unknownMethodError["reason"] = "XmlRequest"; ; - unknownMethodError["message"] = "Unknown Rpc request"; - unknownMethodError["login"] = "false"; - response.Value = unknownMethodError; - } - - return XmlRpcResponseSerializer.Singleton.Serialize(response); - } - - //protected virtual string ParseREST(string request, string path, string method) - //{ - // string response; - - // string requestKey = String.Format("{0}: {1}", method, path); - - // string bestMatch = String.Empty; - // foreach (string currentKey in m_restHandlers.Keys) - // { - // if (requestKey.StartsWith(currentKey)) - // { - // if (currentKey.Length > bestMatch.Length) - // { - // bestMatch = currentKey; - // } - // } - // } - - // RestMethodEntry restMethodEntry; - // if (m_restHandlers.TryGetValue(bestMatch, out restMethodEntry)) - // { - // RestMethod restMethod = restMethodEntry.RestMethod; - - // string param = path.Substring(restMethodEntry.Path.Length); - // response = restMethod(request, path, param); - - // } - // else - // { - // response = String.Empty; - // } - - // return response; - //} - - - protected virtual string ParseXMLRPC(string requestBody) - { - string responseString = String.Empty; - - XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); - - string methodName = request.MethodName; - - responseString = ProcessXMLRPCMethod(methodName, request); - - return responseString; - } public virtual void HandleRequest(Object stateinfo) { @@ -203,7 +106,7 @@ namespace OpenSim.Framework.Servers } else { - HandleLegacyRequests(request, response); + HandleXmlRpcRequests(request, response); } } @@ -234,64 +137,54 @@ namespace OpenSim.Framework.Servers } } - private void HandleLegacyRequests(HttpListenerRequest request, HttpListenerResponse response) + private void HandleXmlRpcRequests(HttpListenerRequest request, HttpListenerResponse response) { - Stream body = request.InputStream; + Stream requestStream = request.InputStream; Encoding encoding = Encoding.UTF8; - StreamReader reader = new StreamReader(body, encoding); + StreamReader reader = new StreamReader(requestStream, encoding); string requestBody = reader.ReadToEnd(); - body.Close(); reader.Close(); + requestStream.Close(); - //Console.WriteLine(request.HttpMethod + " " + request.RawUrl + " Http/" + request.ProtocolVersion.ToString() + " content type: " + request.ContentType); - //Console.WriteLine(requestBody); + XmlRpcRequest xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); - string responseString = ""; - // Console.WriteLine("new request " + request.ContentType +" at "+ request.RawUrl); - switch (request.ContentType) - { - case "text/xml": - // must be XML-RPC, so pass to the XML-RPC parser - - responseString = ParseXMLRPC(requestBody); - responseString = Regex.Replace(responseString, "utf-16", "utf-8"); - - response.AddHeader("Content-type", "text/xml"); - break; - - //case "application/xml": - //case "application/octet-stream": - // // probably LLSD we hope, otherwise it should be ignored by the parser - // // responseString = ParseLLSDXML(requestBody); - // responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - // response.AddHeader("Content-type", "application/xml"); - // break; - - //case "application/x-www-form-urlencoded": - // // a form data POST so send to the REST parser - // responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - // response.AddHeader("Content-type", "text/html"); - // break; - - //case null: - // // must be REST or invalid crap, so pass to the REST parser - // responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod); - // response.AddHeader("Content-type", "text/html"); - // break; + string methodName = xmlRprcRequest.MethodName; + + XmlRpcResponse xmlRpcResponse; + XmlRpcMethod method; + if (this.m_rpcHandlers.TryGetValue(methodName, out method)) + { + xmlRpcResponse = method(xmlRprcRequest); } + else + { + xmlRpcResponse = new XmlRpcResponse(); + Hashtable unknownMethodError = new Hashtable(); + unknownMethodError["reason"] = "XmlRequest"; ; + unknownMethodError["message"] = "Unknown Rpc Request ["+methodName+"]"; + unknownMethodError["login"] = "false"; + xmlRpcResponse.Value = unknownMethodError; + } + + response.AddHeader("Content-type", "text/xml"); + string responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); + + // This must be absolutely fuggliest hack in this project. Don't just stand there, DO SOMETHING! + responseString = Regex.Replace(responseString, "utf-16", "utf-8"); + byte[] buffer = Encoding.UTF8.GetBytes(responseString); - Stream output = response.OutputStream; + + response.SendChunked = false; response.ContentLength64 = buffer.Length; + response.ContentEncoding = Encoding.UTF8; - - - output.Write(buffer, 0, buffer.Length); - output.Close(); + response.OutputStream.Write(buffer, 0, buffer.Length); + response.OutputStream.Close(); } public void Start() diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs index 95e9707..5fcf678 100644 --- a/OpenSim/Framework/Servers/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs @@ -7,19 +7,19 @@ namespace OpenSim.Framework.Servers { public abstract class BaseStreamHandler : IStreamHandler { - public string ContentType + virtual public string ContentType { get { return "application/xml"; } } private string m_httpMethod; - public string HttpMethod + virtual public string HttpMethod { get { return m_httpMethod; } } private string m_path; - public string Path + virtual public string Path { get { return m_path; } } diff --git a/OpenSim/Framework/Servers/ILlsdMethodHandler.cs b/OpenSim/Framework/Servers/ILlsdMethodHandler.cs deleted file mode 100644 index 5382f2d..0000000 --- a/OpenSim/Framework/Servers/ILlsdMethodHandler.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -namespace OpenSim.Framework.Servers -{ - public interface ILlsdMethodHandler - { - string Handle(string request, string path); - } - - -} diff --git a/OpenSim/Framework/Servers/LlsdMethod.cs b/OpenSim/Framework/Servers/LlsdMethod.cs deleted file mode 100644 index d17fa38..0000000 --- a/OpenSim/Framework/Servers/LlsdMethod.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* -* Copyright (c) Contributors, http://www.openmetaverse.org/ -* See CONTRIBUTORS.TXT for a full list of copyright holders. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of the OpenSim Project nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -namespace OpenSim.Framework.Servers -{ - public delegate TResponse LlsdMethod( TRequest request ); -} diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj index 4eb9844..cf2236a 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj @@ -99,21 +99,12 @@ Code - - Code - Code - - Code - Code - - Code - Code diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build index 5e96ef1..f837c22 100644 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build @@ -14,11 +14,8 @@ - - - diff --git a/OpenSim/Framework/Servers/RestMethodEntry.cs b/OpenSim/Framework/Servers/RestMethodEntry.cs deleted file mode 100644 index ab926e0..0000000 --- a/OpenSim/Framework/Servers/RestMethodEntry.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.Servers -{ - public class RestMethodEntry - { - private string m_path; - public string Path - { - get { return m_path; } - } - - private RestMethod m_restMethod; - public RestMethod RestMethod - { - get { return m_restMethod; } - } - - public RestMethodEntry(string path, RestMethod restMethod) - { - m_path = path; - m_restMethod = restMethod; - } - } -} -- cgit v1.1 From 8bdbdf48c7896a7cb47d49544ab528a508e557c9 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 5 Jul 2007 18:30:30 +0000 Subject: * updated bugfixed xmlrpc for massive win * got rid of the ugliest hack in the project --- OpenSim/Framework/Servers/BaseHttpServer.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 84af9f6..f790477 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -173,12 +173,8 @@ namespace OpenSim.Framework.Servers string responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); - // This must be absolutely fuggliest hack in this project. Don't just stand there, DO SOMETHING! - responseString = Regex.Replace(responseString, "utf-16", "utf-8"); - byte[] buffer = Encoding.UTF8.GetBytes(responseString); - - + response.SendChunked = false; response.ContentLength64 = buffer.Length; response.ContentEncoding = Encoding.UTF8; -- cgit v1.1 From 5f8de1e7045b9daa2d4f3b21ca826987e32efe6e Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 8 Jul 2007 19:27:04 +0000 Subject: * By popular demand, all generated build files are now deleted. Somebody should make sure the wiki is updated. --- .../Servers/OpenSim.Framework.Servers.csproj | 125 --------------------- .../Servers/OpenSim.Framework.Servers.dll.build | 51 --------- 2 files changed, 176 deletions(-) delete mode 100644 OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj delete mode 100644 OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj deleted file mode 100644 index cf2236a..0000000 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.csproj +++ /dev/null @@ -1,125 +0,0 @@ - - - Local - 8.0.50727 - 2.0 - {2CC71860-0000-0000-0000-000000000000} - Debug - AnyCPU - - - - OpenSim.Framework.Servers - JScript - Grid - IE50 - false - Library - - OpenSim.Framework.Servers - - - - - - False - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\..\bin\ - False - False - False - 4 - - - - False - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\..\bin\ - False - False - False - 4 - - - - - ..\..\..\bin\libsecondlife.dll - False - - - System.dll - False - - - System.Xml.dll - False - - - ..\..\..\bin\XMLRPC.dll - False - - - - - OpenSim.Framework - {8ACA2445-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - OpenSim.Framework.Console - {A7CD0630-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - Code - - - - - - - - - - diff --git a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build b/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build deleted file mode 100644 index f837c22..0000000 --- a/OpenSim/Framework/Servers/OpenSim.Framework.Servers.dll.build +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.1 From 9f5f65c8477e3d05f384bafbb1bdf6dcb3f577c8 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 9 Jul 2007 23:32:29 +0000 Subject: * LLSDStreamhandler now works. --- OpenSim/Framework/Servers/BaseStreamHandler.cs | 2 +- OpenSim/Framework/Servers/RestStreamHandler.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs index 5fcf678..0d9c674 100644 --- a/OpenSim/Framework/Servers/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs @@ -31,7 +31,7 @@ namespace OpenSim.Framework.Servers public abstract byte[] Handle(string path, Stream request); - protected BaseStreamHandler(string path, string httpMethod ) + protected BaseStreamHandler(string httpMethod, string path) { m_httpMethod = httpMethod; m_path = path; diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs index 7ca369d..1b3b41c 100644 --- a/OpenSim/Framework/Servers/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/RestStreamHandler.cs @@ -23,7 +23,7 @@ namespace OpenSim.Framework.Servers return Encoding.UTF8.GetBytes(responseString); } - public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( path, httpMethod ) + public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path ) { m_restMethod = restMethod; } -- cgit v1.1